Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

textfield.focus() problem

 
Rajni Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have more than 2 text field in html. I want to validate first field and if its not validate and than alert shows on page. and i don't want to send control on second field. so I wrote in onchange event on this field and in this I wrote this.focus() and this.select(); but its not work. If only one field in form than this problem solved but for more than 2 field it can not solve. Please any body can help me.

Thanks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the magical code you are talking about that has errors?

Eric
 
Rajni Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its not error coming. But control is going on next field.

<code>
<form name="validationForm">
<table>
<tr>
<td>First Name:</td><td><input type ="text" name="firstName"></td>
</tr>
<tr>
<td>Last Name:</td><td><input type ="text" name="lastName" ></td>
</tr>
<tr>


<td>Email Id:</td><td><input type ="text" id="emailIdText" name="emailid"
onChange = " if (custInfo.validate.validation.validateEmailAddress() == false){
alert('in jsp');
this.focus();
this.select();
} "></td>
<td><div id ="emailIdValidationDiv"></div></td>


</tr>
</code>

Thanks
 
Rajni Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, this is the code






thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic