javascript - With bind/on change how to show a Row -


i have form using coldfusion using binding generate value. after user selects pull down selection automatically generates value 'y' or 'n' generated table. need use value, in case if value 'y' display more questions answered. here current coding looks like.

<td>select category:   <cfselect name="catdesc"   title="select category generate related services"   bind="cfc:servicetype2.cat_description()"   bindonload="true"/><br /> </td> </tr>                                                <tr id="serv_ty2" style="display: inline;">   <td></td>   <td>select service:   <cfselect name="service_type"   bind="cfc:servicetype2.getservicetype2({catdesc})"   bindonload="false"/></td> </tr> <tr id="lr_verify" style="display: inline;">   <td></td>   <td>labor relations required:   <cfinput name="lr_needed" <!---     onchange="document.getelementbyid('lr_question').style.display = (this.selectedindex == y) ? 'inline' : 'none'"--->     bind="cfc:servicetype2.getlr({service_type})"     onchange="editlr()"     bindonload="false"/></td> </tr> 

here additional questions want show if y generated

<tr id="lr_question" name="lr_question" style="display: none;">   <td align="left" nowrap>nbsp;<b>additional question:</b><br>(hold ctrl select multiple)</td>   <td align="left">question:<br><br>   <select id="lr_quest" name="lr_quest" multiple="multiple" required="no" size="5">     <option name="abc" id="abc">     choice 1</option>     <option name="abc2" id="abc2">     choice 2</option>   </select> 

from research tried 2 solutions neither work assuming have incorrect syntax or thinking correct.

here attempt java function was:

function editlr() {   // if 'y' additional questions service type should show   var lrshow = document.getelementbyid("lr_needed");   if( lrshow == 'y' ) {     lr_question.style.display = "inline";              }   else if ( lrshow == 'n' ) {     lr_question.style.display = "none";    }   else if ( lrshow == '' ) {     lr_question.style.display = "none";   } } 

let me know if have suggestion apologize if did not explain myself correctly. in advance assistances still new javascript , coldfusion learning elements available still.

to start, have this:

var lrshow = document.getelementbyid("lr_needed"); 

add line after , see get.

alert("lrshow " + lrshow); 

then see if makes difference:

var lrshow = document.getelementbyid("lr_needed").value; alert("lrshow " + lrshow); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -