Subject: cursor disappearance problem
Posted By: nasirmunir Post Date: 6/30/2008 10:57:34 AM
I have a form with a few fields. The cursor shows up on the respective field where I want to fill out the form. The problem is when I click outside of the field the cursor disappears. It only happens when I click in the area outside of any text field of the form.
Is there anyway to solve this problem ? It happens in both IE and FF
Thanks

Reply By: Old Pedant Reply Date: 6/30/2008 2:30:09 PM
Show sample code???  Certainly doesn't happen on my <FORM>s.

Reply By: nasirmunir Reply Date: 7/1/2008 8:49:51 PM
It is a form with few text fields, say text field 1, and text field 2. If I click on any of the text field, I can see the cursor and can type in whatever I want. The problem is, I want that cursor to persist in one of the text field. For example, if I click outside of the text field the cursor disappears and it comes back when I click on the field area. I want that cursor not to disappear at all and it should show up in the selected text field area.
This happens even with the simplest of the forms with text field. If I create a sample form with two text fields and click outside the text area the cursor disappears. I don't want that to happen.
Any help will be greatly appreciated,
Thanks.

Reply By: Old Pedant Reply Date: 7/1/2008 11:56:27 PM
AHHH!!!  You meant the TEXT cursor!  I thought you meant any cursor at all.  That is, any MOUSE POINTER at all.

Okay, you can do this.  

<HTML><BODY onLoad="document.TheForm.username.focus()">
<FORM name=TheForm>
username <INPUT name=username onblur="this.form.address.focus()"><br>
address <INPUT name=address onblur="this.form.city.focus()"><br>
city <INPUT name=city onblur="this.form.state.focus()"><br>
state <INPUT name=state onblur="this.form.submitButton.focus()"><br>
<INPUT Type=submit name=submitButton value="Submit this info">
</FORM>
</BODY></HTML>
Reply By: nasirmunir Reply Date: 7/2/2008 9:10:13 AM
Thanks a bunch!!!
Now I can see the cursor switching from one text field to another, depending upon the sequence I am giving in "onblur". I still have a question: is there a way of persisting it to the same text area, unless clicked in other text field. I mean if I am in say text field 3, and I click outside of text field 3, it should focus on text field 3 and not to text field 2 or some other.
I understand that we are giving focus to other text fields but can we persist it to the same field ?
Thanks again.

Reply By: Old Pedant Reply Date: 7/2/2008 2:47:59 PM
Of course.

<TEXTAREA ... onblur="this.focus();"></TEXTAREA>

Just set the focus back to itself.

But now there's a major problem!

What about when the user is *DONE* with the textarea and really *DOES* want to move to the next field????

HINT:  HE CAN'T!!!

Once you get to the text area, you would be trapped there.

Now...we *could* set it up so that if the <BODY> received focus, it would automatically go to the textarea.  But is even that good enough???

You know, you really are doing something that most people don't bother worrying about.  Computer users today are smart enough, for the most part, to know that if the cursor is not in a particular field, they can't type there.  I really have to wonder if you are doing a lot of work for no purpose.
Reply By: nasirmunir Reply Date: 7/3/2008 9:09:01 AM
*smiles*
thanks again, really.
It's not me who is caring for the cat, its my boss coming up with cool requirements :)

Reply By: Old Pedant Reply Date: 7/3/2008 3:49:18 PM
quote:
Originally posted by nasirmunir
It's not me who is caring for the cat, its my boss coming up with cool requirements :)



Isn't it nice to work for a boss who doesn't understand technology?  *SIGH*

I thought of a moderately complex way to do all of this, if you care.

As each field receives focus, it sets a global JavaScript variable that points to itself.  Then if the <BODY> receives focus (that is, if the user clicks outside of *any* <FORM> element) it moves the focus *back* to that last form field that had it.

Not ideal.  But only way I can see to solve the <TEXTAREA> problem we both noticed.

Go to topic 72489

Return to index page 1