I wanted a way when admins click "other", then the hidden field would show
('Other Job Title'):
We have 2 fields:
job_title
other_job_title
In your FLEXIcontent Type Item Form (add the following):
//HIDE OTHER JOB FIELD $('#label_outer_fcfield_101, #container_fcfield_101').hide(); //RADIO FIELDS NAME $('input[name="custom[job_title][0]"]').change( function() { //RADIO OTHER VALUE if (this.checked && this.value == 'other') { $('#label_outer_fcfield_101, #container_fcfield_101').show(); } else { $('#label_outer_fcfield_101, #container_fcfield_101').hide(); $('#container_fcfield_101 input').val(''); } }); //ON OPEN/LOAD if ($('input#custom_job_title_0_2').is(':checked') == true) { $('#label_outer_fcfield_101, #container_fcfield_101').show(); }
Here's an image shot of this:
Finally - I used the following code in my item template to get it to work:
Here's an image shot of this:
Finally - I used the following code in my item.php template to get it to work:
$job_title = ''; FlexicontentFields::getFieldDisplay( $item, "job_title", null, 'display', 'item' ); FlexicontentFields::getFieldDisplay( $item, "other_job_title", null, 'display', 'item' ); $job_title = $item->fields[ "other_job_title" ]->display; if ( $job_title == '' ) { $job_title = $item->fields[ "job_title" ]->display; } echo $job_title;
//ONLOAD - choose the unique other value if ($('input#custom_job_title_0_2').is(':checked') == true) { $('#label_outer_fcfield_101, #container_fcfield_101').show(); } or if ($('.fcfieldval_container_70 input[value="other"]').is(':checked') == true) { $('.control-group#id-101').show(); }