![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi I've tried every way I can think of to use dependency to enable additional elements to be required and have had no luck at all. I simply want to enable "required" on a number of fields when a specific radio button is selected and for it to be disabled when its not. (These fields are hidden when the radio button is deselected) I've tested the response from the functions and it appears correct but after hours of staring at this I just can't figure it out. Help.. please? original code is onhttp://promotionalpenshop.com.au/testorder.php?p=4 though I may have changed it by the time you look at this. So basically I've tried an inline function *something like: organisation:{required: function(element) { * * * * return $(".payment_type:checked").val() *== 'invoice'); * * * } * *} - - - - - - - - - - - - - - Setting a var to true/false when the radio button is clicked and testing that: var invoice; $(".payment_type").change(function () { * * *if($(this).val() != 'paypal'){ * * * * * * * * *$("#paybyinvoicefields").slideDown('slow'); * * * * * * * * invoice = *true; * * * * *} else { *$("#paybyinvoicefields").slideUp('slow'); * * * * * * * * invoice = *false; * * * * *} organisation:{required: invoice} - - - - - - - - - - - - - - Using an enternal function organisation:{required: invoiceme() } * * * * function invoiceme() { * * * * * *return ($(".payment_type:checked").val() *== 'invoice')? true : false; * * } |
#3
| |||
| |||
|
|
Bump Hi I've tried every way I can think of to use dependency to enable additional elements to be required and have had no luck at all. I simply want to enable "required" on a number of fields when a specific radio button is selected and for it to be disabled when its not. (These fields are hidden when the radio button is deselected) I've tested the response from the functions and it appears correct but after hours of staring at this I just can't figure it out. Help.. please? original code is onhttp://promotionalpenshop.com.au/testorder.php?p=4 though I may have changed it by the time you look at this. So basically I've tried an inline function *something like: organisation:{required: function(element) { * * * * return $(".payment_type:checked").val() *== 'invoice'); * * * } * *} - - - - - - - - - - - - - - Setting a var to true/false when the radio button is clicked and testing that: var invoice; $(".payment_type").change(function () { * * *if($(this).val() != 'paypal'){ * * * * * * * * *$("#paybyinvoicefields").slideDown('slow'); * * * * * * * * invoice = *true; * * * * *} else { *$("#paybyinvoicefields").slideUp('slow'); * * * * * * * * invoice = *false; * * * * *} organisation:{required: invoice} - - - - - - - - - - - - - - Using an enternal function organisation:{required: invoiceme() } * * * * function invoiceme() { * * * * * *return ($(".payment_type:checked").val() *== 'invoice')? true : false; * * } |
#4
| |||
| |||
|
|
Hi, Validation only triggered if you call submit the page or call the $ ("form").valid() function. I didn't see any submit() or *$ ("form").valid() call in your page. Try adding this to your page js script inside ready() $("#validateMe").click(function(){ * *if($("form").valid()) * * *alert("All data are valid"); * *else * * *alert("Invalid data"); }); html input type="button" id="validateMe" name="validateMe" value="Validate" / Hope this help. BTW: you misspelled territory in ACT ![]() On Nov 6, 12:06*pm, Brad Hile <brad.h... (AT) gmail (DOT) com> wrote: Bump Hi I've tried every way I can think of to use dependency to enable additional elements to be required and have had no luck at all. I simply want to enable "required" on a number of fields when a specific radio button is selected and for it to be disabled when its not. (These fields are hidden when the radio button is deselected) I've tested the response from the functions and it appears correct but after hours of staring at this I just can't figure it out. Help.. please? original code is onhttp://promotionalpenshop.com.au/testorder.php?p=4 though I may have changed it by the time you look at this. So basically I've tried an inline function *something like: organisation:{required: function(element) { * * * * return $(".payment_type:checked").val() *== 'invoice'); * * * } * *} - - - - - - - - - - - - - - Setting a var to true/false when the radio button is clicked and testing that: var invoice; $(".payment_type").change(function () { * * *if($(this).val() != 'paypal'){ * * * * * * * * *$("#paybyinvoicefields").slideDown('slow'); * * * * * * * * invoice = *true; * * * * *} else { *$("#paybyinvoicefields").slideUp('slow'); * * * * * * * * invoice = *false; * * * * *} organisation:{required: invoice} - - - - - - - - - - - - - - Using an enternal function organisation:{required: invoiceme() } * * * * function invoiceme() { * * * * * *return ($(".payment_type:checked").val() *== 'invoice')? true : false; * * } |
![]() |
| Thread Tools | |
| Display Modes | |
| |