Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<BODY onBlur="self.focus()"> & forms

Status
Not open for further replies.

onpnt

Programmer
Dec 11, 2001
7,778
US
I was trying to help someone out and the solution I came up with wasn't what was wanted but could be done. Now I really want to figue it out. Can everyone help out on this?

How can you get around <BODY onBlur=&quot;self.focus()&quot;> preventing you from editing form fields in the window.

it's getting to me please help me out

thanks provide tools to let people become their best.
 
<input .... onfocus=&quot;
TODO : focus some where else
&quot;>



---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
That is what I originaly thought of but I tried that earlier and it did nothing. Do I have what you're saying correct:
<body onLoad=&quot;self.focus()&quot;>

<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;login.asp&quot;>
Log in please<br>
User name: <input type=&quot;text&quot; name=&quot;username&quot; onFocus=&quot;self.focus()&quot;><br>
Password: <input type=&quot;text&quot; name=&quot;pass&quot; onFocus=&quot;self.focus()&quot;><br>
<input type=&quot;submit&quot; value=&quot;Sign in&quot;>
</form>

provide tools to let people become their best.
 
<script>
function nochange(place) {
blur();
place.value=&quot;NOCHANGE&quot;;
}
</script>
<form>
<input onFocus=&quot;nochange(this)&quot; value=&quot;NOCHANGE&quot;>
</form>
---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
If you really need this, you can simply add &quot;readonly&quot; or &quot;disabled&quot; property to the form fields, so there's no need in any scripts at all.

Make things simple.
 
Hi there, I'm the guy onpnt was trying to help out and i'm interested in your ideas, just can't make out how to use them! NEVERSLEEP, I need to gather info from the user in my form and it doesn't look like the function you propose would allow that. I thought of setting a boolean when someone starts using the form and then saying <body onBlur=&quot;if(!beingEdited) self.focus();&quot;> but then if they click in the form then click off the page it loses focus.

I'm at my wits end...?? Any ideas?

Many thx --------------------------------

jb
 
I don't want the form to be uneditable. I need the popup to be loaded self.focus'd but I also want two form fields in the form to have the capability of having data entered into them. The only problem is when you envoke the onBlur=&quot;self.focus()&quot; and then click a text field in that window you cannot enter anything due to focus being lost so quickly on the text field. I may have explained it backwards the first time. Sorry provide tools to let people become their best.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top