Help...How to Clear textbox in

Use javascript, get the id or the name of the field and set its value to "" empty.

<form name="formName">
<input type="text" name="field" id="field_id" value="aaaaa" />

Then write code to execute this javascript:




Definitely check this: for more.

i try it but it doesnt work

Post your code. Have you read the tutorials I gave you?

<SCRIPT language="javascript">

function validate(){
    if (document.getElementById('employerName').value=""){
        alert("Fill in Employer Name");

function reset(){
function box(){
    alert("Employer Successfully Save");

<html:form action="/GetCallEmployerActionPath" onsubmit="box();">
    <table style="margin:50px auto; border:1px solid gray;" border="1">
            <td colspan="2">
                <div id="employerName"><html:text property="employerName"/></div>
            <td colspan="4" align="right">
                <input type="submit" value="Save"/>

I am not familiar with these tags:
<html:text property="employerName"/>
So I don't think that this will work:
The employerName in the getElementById must be the id attribute of the text field.

Also if you want any of the javascript functions you have declared to be executed, you need to call them like you did with box function. Using events: onxxxxxx (onclick, onsubmit).

For the onsubmit, the function you call must return true or false.

function validate(){
   if (employee is empty) {
      alert("your error message");
      return false;
   return true;

<html:form action="/GetCallEmployerActionPath" onsubmit="return validate();">

<html:text property="employerName"/> ====>> this is jsp code using html taglib
if i change it to <input type="text" id="employerName"> it will create an error on my other java action class..
do i need to input the return in my function??

Does this have an id attribute? Can you try to write this:

<html:text property="employerName" id="employerName" />

it doesn't have... :(

Then use something like this and see if it works:

document.<the name of the form the text field is inside>.employerName.value=""