I can't find any documentation that is helping me figure this out. It seems like a very straightforward thing for Parsleyjs to do.
What I want is until my form is valid, to disable the submit button - this is my default in my HTML:
<input id="new-node-form-submit" type="submit" value="done" disabled>
When the form knows it's valid, it should remove the disabled attribute from the submit button. If the form becomes invalid again as the user is filling it out, the disabled attribute should be added back.
I am trying to use the Parsley documentation to add a listener to the form and then check if the form is valid, but I can't seem to get this working. Any suggestions? This seems like a really straightforward thing that somehow I am just not getting.
$( '#new-node-form' ).parsley( 'addListener', {
var isValid = $( '#new-node-form' ).parsley ( 'validate' );
if(isValid == true) {
console.log("Your form is valid!");
}
}