coldfusion - How do I unhide a CFDIV that has dynamic content with AJAX binding itself? -


i have following cfselect tags used populate text input:

<cfselect id="this" name="this" bind="cfc:data.getthis()" bindonload="true" />  <cfselect id="that" name="that" bind="cfc:data.getthat({p1})" />  <cfselect id="theother" name="theother" bind="cfc:data.gettheother({p1}, {p2})" /> 

the text input value needs submitted in form:

<cfform name="additem" method="post" action="somepage.cfm">     <cfinput          type="text"          id="item"          name="item"          bind="cfc:data.getresult({this}, {that}, {theother})" /><br />      <cfinput          type="submit"          name="addbutton"          value="add item" /> </cfform> 

i want form , it's contents visible only when 3 selections have been made, , there value text input. best way this? i'm assuming use of cfdiv best way, i'm not sure how load dynamic content (the cfinputs) way.

<cfselect id="this" name="this" bind="cfc:data.getthis()" bindonload="true" onchange="toggleform();" /> <cfselect id="that" name="that" bind="cfc:data.getthat({p1})" onchange="toggleform();" /> <cfselect id="theother" name="theother" bind="cfc:data.gettheother({p1}, {p2})" onchange="toggleform();" />  <div id="theform" style="display:none"> <cfform name="additem" method="post" action="somepage.cfm">     <cfinput          type="text"          id="item"          name="item"          bind="cfc:data.getresult({this}, {that}, {theother})" /><br />      <cfinput          type="submit"          name="addbutton"          value="add item" /> </cfform> </div>  <script type="text/javascript">     function toggleform(){         var = document.getelementbyid("this").selectedindex;         var b = document.getelementbyid("that").selectedindex;         var c = document.getelementbyid("theother").selectedindex;         if (a > -1 && b > -1 && c > -1){             document.getelementbyid("theform").style.display = "";         }     } </script> 

personally simplify js bit using jquery, don't know if you're using jquery on site, , don't want "use jquery" empty answer; should work without jquery, should want/need go without it. (but jquery awesome!)


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -