events - binding to form submit click with jQuery and waiting for validation panels to be shown before proceeding -
I'm hooking up in HTML form submissions where a specific class using $ (". FormSubmitTypes") in the Submit Buttons is. ('Click', function () {do stuff here});
However - I have to wait to run the client-side verification routine because I have to wait for a particular validation summary to be visible before processing any action - At this time, the first click will be revealed that there are no validation errors, because immediately after clicking, different verification divisions and spans are not shown, obviously because The initial phase of the page is clear from a user input and therefore no error. <2 p>
After the second and every time the Submit buttons, Divisions and Spaces appear and the logging process works - but it is almost useless because I handle this initial click And almost "wait" for the other stuff before I will continue.
Is there a better way to do this? Can I share with anything other than "click", I need an incident almost like "verification" fails and then to implement my actions.
The idea was to inject the injected verification message in the DOM and log in, just to give some context to the process.
I currently have code (short and some abbreviated):
$ ("formSubmitButton"). (Click on "function") (if ($ ("$ verification" messagecontentor) is (": is visible")) {someProcess.Log ('Validation failed', CollectionoffValidationFell message);}}); For any kind of extension, I need to wait #validationMessageContainer to come in the DOM and then bundle it over the hair HTML and log validation errors therein.
Many thanks- SB
Keep in mind that unless your verification is confused Until then, the wait form is a simple task for the result before entering / submitting:
$ ('#formformed'). Submit (function () {var validation = doFormValidation (); // assumes that it returns the creation and returning the object in which: .isValid (bool) and .errors (array of string error messages) if (! Validation.isValid) {DisplayAndLogValidationErrors (validation.errors); // Here you can test your logic to see if special error messages are already logged in, perhaps create an object that contains log messages in an array , And test to see it only Whether there is an error message before logging in that orter.} Return validation. This is correct; // When valid is false, this will stop the form from being submitted.}); I think you'll have better luck in the submit event on your form than the click of your button. It is easy to stop presenting this method and handle such scenarios where the form will be submitted, say, by pressing Enter.
Comments
Post a Comment