HighDots Forums  

(validate plugin) dependency callback not being triggered

jQuery jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.


Discuss (validate plugin) dependency callback not being triggered in the jQuery forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Brad Hile
 
Posts: n/a

Default (validate plugin) dependency callback not being triggered - 11-05-2009 , 04:42 AM






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 on http://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;
}

Reply With Quote
  #2  
Old   
Brad Hile
 
Posts: n/a

Default Re: (validate plugin) dependency callback not beingtriggered - 11-05-2009 , 08:06 PM






Bump

Quote:
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;
* * }

Reply With Quote
  #3  
Old   
Jules
 
Posts: n/a

Default Re: (validate plugin) dependency callback not beingtriggered - 11-05-2009 , 10:14 PM



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:
Quote:
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;
* * }

Reply With Quote
  #4  
Old   
Brad Hile
 
Posts: n/a

Default Re: (validate plugin) dependency callback not beingtriggered - 11-09-2009 , 03:32 AM



Thanks Jules I'll give it a try now.
I was looking for something that would trigger the validation but I
thought it was automagically triggered onblur/keyup but perhaps thats
only after the initially validate via submit

* thanks for the typo spotting!.. totally missed that

ta
Brad

On Nov 6, 11:14*am, Jules <jwira... (AT) gmail (DOT) com> wrote:
Quote:
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;
* * }

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.