ruby - Disable jQuery Validate plugin -


i'm completing form using web driver , need bypass 2 form fields using browser.execute_script() insert hidden form field dom.

however need disable existing validation methods in order submit form. form uses jquery validate. can advise how disable part or of jquery validate?

i tried using following, error typeerror: d undefined

b.execute_script('     $("firstmemorablecharacter").rules("remove");     $("secondmemorablecharacter").rules("remove"); ') 

where firstmemorablecharacter name of form field has attached validation rules.

the validation set using jquery validate follows:

with($.validator) {     addmethod(...);  setdefaults({     ....     messages: { },     rules: {             firstmemorablecharacter: {                 radiohasvalue: true             },             secondmemorablecharacter: {                 radiohasvalue: true             }     } }); 

(the rules shown above ones need disable.)

thanks in advance.

update:

following post, how remove jquery validation form? , tried submitting form using html dom (bypassing jquery) using $("#form-id")[0].submit();. however, not work - seems there additional javascript within jquery needs executed in order form submit properly.

therefore need way of disabling these 2 rules within jquery validate, rather disabling whole of jquery or jquery validate.

can advise how disable part or of jquery validator?

once initialized, cannot disable part of it. however, can dynamically manipulate rules using the .rules() method you've guessed.

just make sure .rules() method called sometime after .validate() or fail.

see simple demo: http://jsfiddle.net/qdjms/


there syntax error in code below.

$("firstmemorablecharacter").rules("remove"); $("secondmemorablecharacter").rules("remove"); 

notice 2 jquery selectors meaningless.

if you're trying target id, you'll need # in front...

$("#firstmemorablecharacter").rules("remove"); $("#secondmemorablecharacter").rules("remove"); 

from comments, noticed element contains id="firstmemorablecharacter1", need spell id same...

$("#firstmemorablecharacter1").rules("remove"); 

otherwise, target them name shown in demo...

$("[name='firstmemorablecharacter']").rules("remove"); $("[name='secondmemorablecharacter']").rules("remove"); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -