Show input field on radio select

More
3 years 1 month ago - 3 years 1 month ago #80840 by iamrobert
I wanted a way when admins click "other", then the hidden field would show ('Other Job Title'):



YOUTUBE DEMO:


I applied the following code in my FLEXIcontent Type Item Form:

Code:
//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[name="custom[job_title][0]"]').is(':checked') == true) {       $('#label_outer_fcfield_101, #container_fcfield_101').show();  }




Cheers

Robert Stark
Last edit: 3 years 1 month ago by iamrobert.

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago #80842 by micker
Yes its very cool to share tour tips
Can you put it in tutorial part (or i Can do it)
Did you test master field fonction ? As i known it hide child field if nothing IS selected

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #80843 by iamrobert
I think the master field only works with more radios or selects - not inputs. Or did I miss something?
Last edit: 3 years 1 month ago by iamrobert.

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #80848 by iamrobert
Hi Micker,

Use this tutorial code if possible - it shows how I used the code in my template:
gist.github.com/iamrobert/013415dfdfad47fd53e39d7efe3e09ff

I tried to paste the code but the front editor kills me:




What its supposed to look like:

Last edit: 3 years 1 month ago by iamrobert.

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #80849 by iamrobert
Actually - the onload code should be this:

Code:
//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();     }
Last edit: 3 years 1 month ago by iamrobert.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.844 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline