|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
select box result to show/hide another select box. jqueryok this is kinda like a 2 select related, but not really.. i want to show a 2nd selecty box only if the first select box is value 6 This works great on change when you are in the form. but if i am updating the form. it doesn't see the default value.. which is in a var called StrType prt_type is the first select prt_prog_1 is the div id surrounding 2nd select <script> $(function(){ $("#prt_type").change(function () { var val = $(this).val(); switch(parseInt(val)){ case 6: $("#prt_prog_1").show(); break; case 1: case 2: case 3: case 4: case 5: case 7: case 8: case '': $("#prt_prog_1").hide(); break; } }); }); </script> i tried just doing a <cfif StrType EQ 6 > to surround the stuff that does work.. but i cant then ge t the change of states... <!--- <cfif StrType EQ 6> ---> <div id="prt_prog_1"> <select name="prt_prog" id="prt_prog"> <option value="0">Select</option> <option value="1" <cfif StrProg EQ 1> selected</cfif>>Elite</option> <option value="2" <cfif StrProg EQ 2> selected</cfif>>Preferred</option> <option value="3" <cfif StrProg EQ 3> selected</cfif>>Authorized</option> </select> </div> <!--- </cfif> ---> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328301 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: select box result to show/hide another select box. jqueryso just to clarify. the show hide js works fine on its own, just doesn't check or see the default value from the existing data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328302 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: select box result to show/hide another select box. jqueryPaul, You need to "trigger" the change method when you initialize your code: On Thu, Nov 12, 2009 at 11:07 AM, Paul Ihrig <pihrig@...> wrote: > > <script> > $(function(){ > $("#prt_type").change(function () { > var val = $(this).val(); > switch(parseInt(val)){ > case 6: > $("#prt_prog_1").show(); > break; > case 1: case 2: case 3: case 4: case 5: case 7: case > 8: case '': > $("#prt_prog_1").hide(); > break; > } > }); > }); > </script> > > <script> $(function(){ $("#prt_type").change(function () { var val = $(this).val(); switch(parseInt(val)){ case 6: $("#prt_prog_1").show(); break; case 1: case 2: case 3: case 4: case 5: case 7: case 8: case '': $("#prt_prog_1").hide(); break; } }).trigger("change"); }); </script> That will force jQuery to fire the change event handler, just as if the browser actually fired the event. -Dan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328304 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: select box result to show/hide another select box. jqueryOn Thu, Nov 12, 2009 at 11:08 AM, Paul Ihrig <pihrig@...> wrote: > > so just to clarify. > the show hide js works fine on its own, just doesn't check or see the > default value from the existing data > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328305 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: select box result to show/hide another select box. jqueryDan. Thank You. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328309 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: select box result to show/hide another select box. jquerybtw. how other then this list could i have found the answer? i tried google = fail On Thu, Nov 12, 2009 at 1:30 PM, Paul Ihrig <pihrig@...> wrote: > Dan. > Thank You. > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328310 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
| Free embeddable forum powered by Nabble | Forum Help |