GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes textfield.focus() problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "textfield.focus() problem" Watch "textfield.focus() problem" New topic
Author

textfield.focus() problem

Rajni Patel
Ranch Hand

Joined: Sep 03, 2009
Posts: 84
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
What is the magical code you are talking about that has errors?

Eric
Rajni Patel
Ranch Hand

Joined: Sep 03, 2009
Posts: 84
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

Joined: Sep 03, 2009
Posts: 84
sorry, this is the code






thanks
 
GeeCON Prague 2014
 
subject: textfield.focus() problem