|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I need some help to perform a "jump" from one field to another in a form.
My problem is: i should to do this after first field validation (if size = 11, then jump). Actually, I'm using the OnKeyPress first field event, to run this javascript function: --------------------------------------------- FieldSize = document.forms[0].EdtField1. value.length if ( FieldSize == 11) { alert( "I will jump to field 2" ); document.forms[0].EdtField2.focus(); return true; } return false; --------------------------------------------- However, using Internet Explorer 4, I got a value of 10 for 'FieldSize', and using Internet Explorer 5, I got 11!!! One more thing: when I lose first field focus (user press TAB or something like that), I checked if this field already have 11 chars, using the 'OnFocus' event from second field (can't use 'OnBlur' in this case) to run this code: --------------------------------------------- strField1 = document.forms[0].EdtConta.value; if ( strField1.length != 11 ) { alert("Field1 must have 11 chars!"); document.forms[0].EdtField1.focus(); return false; } return true; --------------------------------------------- In this case, using IE4 and IE5, I got strField1.length = 11 when the first field really have 11 chars... but using NETSCAPE, I got 10!!!! What's happen??? Thanks all. ------------------ Adriano Pereira (apereira@hsbc.com.br) (adrianop@cwb.matrix.com.br) |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Jumping Fields in a Form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|