casperin/nod

How do you validate hidden input values?

Closed this issue · 4 comments

Example:

Is this possible to do?

The code below did not work. thanks for your help.

var n = nod();

// We disable the submit button if there are errors.
n.configure({
submit: '.configure_blar_button',
disableSubmit: true
});

n.add([{
selector: '#blar_title',
validate: 'min-length:2',
errorMessage: 'Your name must be at least two characters long.'
}
]);

oh i meant the input tag is hidden [style="display:none;" ] and
i want to validate it's value base on the contenteditable div input.

Something like this:

<div class="editable_wrapper">

       <div class="form_editable"  id="title" contenteditable="true">
               abc 
       </div>
      <input id="blar_title" name="blar[title]" style="display:none;" type="text" value="abc">

</div>

Maybe you forgot to fire a change event? This works exactly as I'd expect it to:
http://jsfiddle.net/bygc9cc5/2/

and http://jsfiddle.net/bygc9cc5/1/ for a version where the input field is not hidden.

Hi Casperin :-p

Thanks for the quick response ;-)
Yeah, you right, i did not fire a change of event after the validation.
Thanks for the guidance.