'Real time form validation [closed]

I have a problem with real time form validation. I use this script http://position-relative.net/creation/formValidator to validate some forms but I need some changes and I don't know how to make them. Can I display error messages outline the form (one box for all messages)? Let's say in a box in a page corner (not above every input like now)? If yes, does anyone know how? Also, I need a rule to check if a input is unique (the user can't insert same value on different fields). Maybe anyone knows another script with this options. Can anyone help me? I'm new in JS and I have to get this done.

Thanks a lot!



Solution 1:[1]

You may want to use jQuery Validation. It does what you are asking for.

You can create your own rules for validation and that way you can accomplish the unique values for every input box requirement.

Solution 2:[2]

There is an event you can hook into jqv.form.result to push a message into a specific div and also to perform some additional validation, you could push your own error messages back into the errorFound object.

jQuery("#formID").validationEngine();

$("#formID").bind("jqv.form.validating", function (event) {
    $("#hookError").html("");
});

$("#formID").bind("jqv.form.result", function (event, errorFound) {
    if (errorFound) $("#hookError").append("There is some problems with your form");
});
<form id="formID" class="formular" method="post" action="">  
<div id="hookError" style="color:red; font-weight:bold;height:20px;"></div>

I've had a look through the source code for the library, your best bet is to inspect the errorFound object passed into the jqv.form.result event handler, with a bit of luck you'll be able to run through a collection of error messages and write them into the hookError div.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Asdfg
Solution 2 xxx