Java script not working

sasis August 24, 2014

I have two custom fields.One select field .I need one description field to be filled if answe is No

<script type="text/javascript">

FeatureToggle = document.getElementById('12000');

if (FeatureToggle) {

target = document.getElementById('12100');

if (FeatureToggle =='Yes') target.style.display='none';

FeatureToggle.onchange=function() {

if (this.value =='No') {

target.style.display = '';

target.value="Why feature toggle is No";

} else {

target.style.display='none';

}

}

}

</script>

2 answers

0 votes
Adrian Moerchen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 25, 2014
  1. Please put your code in a code block to improve visibility
  2. What else have you tried?
    1. Already debugged your Javascript code? How should this work? For instance FeatureToggle is an element, how should this be "Yes"?
  3. Put your code in
    jQuery(function(jQuery){ // Your code here});
    to be sure, it is loaded after all elements are rendered.
  4. Use jQuery to add event listeners, find and alter elements, to be sure you are cross browser compatible

sasis August 25, 2014

is this script correct.Its not working after adding it.Also i added in here custom fields---)right click ---)configure ---)description.

please advise.Als advise if there is anyother script for the requirement

sasis August 25, 2014

Hi,

Thanks for looking.

I have a select list with yes or No that is FeatureToggle .My requirement is if user selects no he should give expalanation.So i created another field which is a text field.I need this mandatory/fill if he selects no.

Kindly help

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 25, 2014

Have you tried Adrien's suggestions yet? Repeating the question is of no help, you need to think through the responses you get and respond to them with more information.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 24, 2014

And your question is ... ?

Suggest an answer

Log in or Sign up to answer