Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear all the validation errors displayed in the JSP page?

Tags:

jsp

I've a view page which looks like:

<tr>
    <td align="right"><b>Select your role:</b></td>
    <td align="left">
        <select name="role" id="role" onchange="enableTextBox();">
            <option value="Admin">Admin</option>
            <option value="csc">CSC Employee</option>
        </select><br/>
        <font color=red>
            <form:errors path="role" cssClass="validationError"/>
        </font>
    </td>
</tr>

<tr align=center>
    <td align="right"><b>User ID:</b></td>
    <td align="left">
        <input type="text" id="uname" name="uname" value="" size="15" /><br/>
        <font color="red">
            <form:errors path="uname" cssClass="validationError"/>
        </font>
    </td>
</tr>

<tr align=center>
    <td align="right"><b>Password:</b></td>
    <td align="left">
        <input type=password id="pwd" name="pwd" value="" size="15" /><br/>
        <font color="red">
            <form:errors path="pwd" cssClass="validationError"/>
        </font>
    </td>
</tr>

I've validated the page which throws error in red colored font near the input field. Suppose admin logs in and the error message is displayed after validation. Now, if the admin wants to select "csc employee" from the dropdown list, I need these error messages to be remove and just the input fields should be displayed.

Please help me!

like image 740
lakshmi Avatar asked Jan 23 '26 16:01

lakshmi


1 Answers

Use javascript to clear those form errors using events while typing on those fields...

like image 134
Narayan Subedi Avatar answered Jan 27 '26 00:01

Narayan Subedi