| | Discussion and Rate this Resource Overall Rating: 3.9 | dpsers on Aug 12, 1999 at 1:38:52 PM | No Rating | |
Is there a fix for this problem yet?:
In IE5 or IE4, in a 2 character field enter 2 characters, go back to the field, select all characters in the field and hit a character key. The cursor jumps to the next field. That is not correct, because the 2 characters have been overtyped by one character. The cursor should NOT move to the next field if all characters in the field are selected.
In IE5, this can happen in a one character field as well as the above.
Does anyone have a solution?
| | flibz on Jun 15, 1999 at 5:29:27 AM | No Rating | | Oh yeah, and it traps keycodes for shift + tab, cursor left, etc as well - sometimes you just wanna edit ;) | | flibz on Jun 15, 1999 at 5:27:55 AM | Rating: 4 | OK, this is a pretty good script (albeit that I dont use Netscape anymore - developing for intranets cross browser doesnt matter.....but i'm sure somebody out there can butcher it for Netscape.
However, i did have a few problems with it - namely if you have other field types (i.e. select, radio etc) they don't have a maxlength property so it errors on keydown, and if you have any hidden fields if you try to set focus to them it errors. Heres my VB Script mods to the script which trap and solve these issues....
<script language="vbscript"> sub document_onkeyup set objitem=window.event.srcelement
this_tagname = objitem.tagname this_type = objitem.type
if this_tagname = "INPUT" and this_type = "text" then this_name=objitem.name keycode= window.event.keycode this_length=len(objitem.value) this_max=objitem.maxlength if this_length = this_max and (keycode > 47 or keycode = 32) then count=0 for each objitem in document.forms(0) if this_name = objitem.name then this=count+1 this_type = document.forms(0).elements(this).type while this_type = "hidden" this=this+1 this_type = document.forms(0).elements(this).type wend document.forms(0).elements(this).focus() end if count=count+1 next end if end if end sub
</script>
err, there's no comments cos i'm too damned lazy but there's nothing too complexe going on really.... | | Rodrigo on Apr 20, 1999 at 3:20:10 PM | No Rating | With IE5 I have 3 fields with size= 2 and MAXLENGTH=2. When I fill all fields and the go back to first field i can input more 1 character each time.
To correct this, I changed the last if (IE5) to:
if (IE5) if (el.value.length<el.maxLength){ el.value += key; event.returnValue = ''; }
this way is working fine in IE5 | | bobharris on Apr 5, 1999 at 12:48:04 PM | No Rating | if (i != el.form.elements.length - 1){
If you don't check against the length -1 then it will break.
Without this you will get a javascript error as it tries to find a index that doesn't exist |
More Ratings/ Comments
To rate and comment on a resource, you must first logon.
If you are not registered, please register yourself to become a member of the SiteExperts.community.
|