May 24, 2013, 09:52:30 PM

Login with username, password and session length

FORUM POSTING GUIDELINES - Please read and follow them.

Pages: [1] 2
  Print  
Author Topic: Hide listing tittle and populate it with custom fields  (Read 3377 times)
Blink
Sr. Member
****
Offline Offline

Posts: 150


« on: July 15, 2012, 01:35:47 AM »

Hi guys,

I have looked every where and can't come up with any conclusive answers.

What I need to do is hide listing tittle and populate it with custom fields.

Hiding the title is simple but populating it with custom fields like (jr_year, jr_make, jr_model) is proving difficult.

Could you please help.

Thanks in advance
Logged
Kristian
Global Moderator
Hero Member
*
Offline Offline

Posts: 9567



WWW
« Reply #1 on: July 15, 2012, 03:12:02 AM »

Hi,

There is no quick and simple solution for this, but you can try this one:
http://www.reviewsforjoomla.com/forum/index.php?topic=9970.0
Logged

Blink
Sr. Member
****
Offline Offline

Posts: 150


« Reply #2 on: July 15, 2012, 09:58:41 AM »

Thanks Kristian
Logged
Blink
Sr. Member
****
Offline Offline

Posts: 150


« Reply #3 on: July 15, 2012, 01:43:31 PM »

Thanks Kristian but I'm completely lost..  Huh

I think the code:

submit: function (element)
                {
var fieldone = jQuery('#jr_fieldone ').val();
var fieldtwo = jQuery('#jr_fieldtwo ').val();
var fieldthree= jQuery('#jr_fieldthree').val();
var customTitle = fieldone + ' ' + fieldtwo + ' ' + fieldthree;
jQuery('#jr_listingTitle').val(customTitle);
                    var form = jQuery('#jr_listingForm');
                    form.find('#section').val(form.find('#section_id option:selected').text());
                    form.find('#category').val(form.find('#cat_id option:selected').text());
                    jQuery('.wysiwyg_editor').RemoveTinyMCE();
                    jQuery(element).siblings('.jr_loadingSmall').fadeIn();
                    jQuery('#jr_listingForm .button').attr('disabled','disabled');
                    document.jr_listingForm.submit();
                }

in  http://www.reviewsforjoomla.com/forum/index.php?topic=9970.0
might refer to an older version of jreviews and does not seem to work for me.

I have tried what seems like every thing including just adding this part

var fieldone = jQuery('#jr_fieldone ').val();
var fieldtwo = jQuery('#jr_fieldtwo ').val();
var fieldthree= jQuery('#jr_fieldthree').val();
var customTitle = fieldone + ' ' + fieldtwo + ' ' + fieldthree;
jQuery('#jr_listingTitle').val(customTitle);

to line 466 in jreviews.js

I have looked all around this forum for this topic with no success.

   
Hiding the Item Title in new item creation
« on: July 24, 2008, 09:53:24 PM »
http://www.reviewsforjoomla.com/forum/index.php?topic=4571.msg23093#msg23093
  
<input type="button" id="submitButton" name="submitButton" value="<?php __t("Submit");?>" onclick="xajax.$('title').value = xajax.$('jr_name').value; submitListing();" class="button" />

********** Listing submit button would not function


   
AUTO listing Title
« on: May 11, 2012, 07:20:50 AM »
http://www.reviewsforjoomla.com/forum/index.php?topic=19814.0

<script language="JavaScript" type="text/JavaScript">
<!--
function combine(form) {
form.title.value = form.jr_yourfield.value;}
</script>

**********I thought this was promising but it only worked for me only on listings that were created prior to this hack being implemented. When I tried to add a new listing after putting in place the hack, the listing submit page just locked up with a busy signal.

I'm going crazy.. Huh
Any help would be great!

Thanks in advance
« Last Edit: July 15, 2012, 11:38:30 PM by Jon Gill » Logged
Kristian
Global Moderator
Hero Member
*
Offline Offline

Posts: 9567



WWW
« Reply #4 on: July 16, 2012, 02:14:27 AM »

Check the Console in Chrome or Firebug to see the errors when submitting a new listing.
There is no point in using the code from the forum post from 2008 year, the code was completely different then.
Logged

Blink
Sr. Member
****
Offline Offline

Posts: 150


« Reply #5 on: July 16, 2012, 09:10:31 AM »

Got this one to work fully.

AUTO listing Title
« on: May 11, 2012, 07:20:50 AM »
http://www.reviewsforjoomla.com/forum/index.php?topic=19814.0

I was not placing the script in the correct place.

Sometimes it take a fresh pair of eyes to see the light..

Thanks
Logged
Blink
Sr. Member
****
Offline Offline

Posts: 150


« Reply #6 on: July 16, 2012, 02:40:44 PM »

Hi Kristian,

Can you or Alejandro shed some light on this.

The the Java Script, is there a simple solution to display the text of a single select field and not the value?

http://www.reviewsforjoomla.com/forum/index.php?topic=19814.msg85720#msg85720

Cheers!
Logged
Alejandro
Global Moderator
Administrator
Hero Member
*
Offline Offline

Posts: 28418


« Reply #7 on: July 16, 2012, 03:02:57 PM »

In jQuery you use jQuery('#element_id').text(). I guess you can try using text instead of value in your code to see if that works.
Logged

http://www.reviewsforjoomla.com/testimonials Leave a testimonial for JReviews
Blink
Sr. Member
****
Offline Offline

Posts: 150


« Reply #8 on: July 16, 2012, 03:29:16 PM »

First thing I tried and it didn't work.  Sad

<script language="JavaScript" type="text/JavaScript">
<!-- Script to use custom field for the title -->
function combine(form) {
form.title.value = form.jr_testtitle.text + " " + form.jr_testtitletwo.text;}
</script>

Any other suggestions?
« Last Edit: July 16, 2012, 03:33:17 PM by Jon Gill » Logged
Kristian
Global Moderator
Hero Member
*
Offline Offline

Posts: 9567



WWW
« Reply #9 on: July 16, 2012, 03:40:28 PM »


This should grab the selected option text:

jQuery('#jr_testtitle option:selected').text();
Logged

Blink
Sr. Member
****
Offline Offline

Posts: 150


« Reply #10 on: July 16, 2012, 06:24:33 PM »

Thanks Guys!!

Finally a solution:  Cheesy

I am using it for three single select lists that are are set for "required" so there is no need for any if statements.

Code and method used:

Step 1: Place this code in themes/YourTheme/listings/create_form.thtml
 
Code:
<script language="JavaScript" type="text/JavaScript">
<!--
function combine(form) {
form.title.value = jQuery('#jr_testtitle option:selected').text() + " " + jQuery('#jr_testtitletwo option:selected').text() + " " + jQuery('#jr_testtitlethree option:selected').text();}
</script>

before

Code:
<?php 
/**********************************************************************************
 *                                 CONFIGURATION AND SETUP
 **********************************************************************************/
$isNew $listing['Listing']['listing_id'] == 0;

Step 2: Change the jr_testtitle, jr_testtitletwo and jr_testtitlethree to the desired field ids.

Step 3 Hide the Title and title alias field by changing the following codes:
From
Code:
<div class="jr_fieldDiv" id="jr_listingTitle">
to
Code:
<div class="jr_fieldDiv" style="display:none;" id="jr_listingTitle">

And from
Code:
<div class="jr_fieldDiv" id="jr_listingTitleAlias"><
to
Code:
<div class="jr_fieldDiv" style="display:none;" id="jr_listingTitleAlias">


Step 4: Add an onclick function to the submit button

Change the following code:
From
Code:
<input id="jr_submitListing" type="button" onclick="jreviews.listing.submit(this);" class="jrButton" value="<?php __t("Submit");?>">
To
Code:
<input id="jr_submitListing" type="button" onclick="combine(this.form); jreviews.listing.submit(this);" class="jrButton" value="<?php __t("Submit");?>">

See also: http://www.reviewsforjoomla.com/forum/index.php?topic=19814.msg85720#msg85720

Thanks again to all involved!!!

NOTE: THIS DOES NOT WORK WITH RADIO BUTTONS, CHECK BOXES AND MULTI-SELECT LISTS
« Last Edit: July 16, 2012, 07:31:05 PM by Jon Gill » Logged
Blink
Sr. Member
****
Offline Offline

Posts: 150


« Reply #11 on: August 06, 2012, 04:35:07 PM »

Update:

I had to change the jr_year field to an integer to give me the range search.

so I needed to modify the code slightly to accommodate for that type of field.

Code:
<script language="JavaScript" type="text/JavaScript">
function combine(form) {
form.title.value = jQuery('#jr_condition option:selected').text() + " " + form.jr_year.value + " " + jQuery('#jr_make option:selected').text() + " " + jQuery('#jr_model option:selected').text();}
</script>

« Last Edit: August 06, 2012, 06:06:29 PM by Blink » Logged
Blink
Sr. Member
****
Offline Offline

Posts: 150


« Reply #12 on: August 06, 2012, 06:06:40 PM »


Works great but I can't get it to work for fields that are radio buttons. Huh

Any ideas anybody
Logged
Kristian
Global Moderator
Hero Member
*
Offline Offline

Posts: 9567



WWW
« Reply #13 on: August 07, 2012, 05:34:48 AM »

There is no simple way to do this with radio buttons. When someone selects a value, nothing changes in html, all radio buttons still use the same markup, so jQuery can't know which value was selected.
Logged

Alejandro
Global Moderator
Administrator
Hero Member
*
Offline Offline

Posts: 28418


« Reply #14 on: August 07, 2012, 06:49:10 AM »

To get the value of a checked radio button in a radio button list

http://stackoverflow.com/questions/9806187/get-value-of-checked-radio-button-in-radio-button-list
Logged

http://www.reviewsforjoomla.com/testimonials Leave a testimonial for JReviews
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!