Connecting Tech Pros Worldwide Forums | Help | Site Map

Focus after submit

Nacho
Guest
 
Posts: n/a
#1: Jul 23 '05
Hello..

I have a problem with the focus that I had when the page reloaded, I
dont know how to do it. I have 2 option selected in my page, when I
select one option and the page automatic reload, and load the other
select with the information that I selected before, but the focus star
in the first field that is a Textbox, I want to still when I was before
the load done.

How I can do that?

thenks

Nacho

kaeli
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Focus after submit


In article <1116451418.064886.147640@g44g2000cwa.googlegroups .com>,
mikicazares@yahoo.com enlightened us with...[color=blue]
> Hello..
>
> I have a problem with the focus that I had when the page reloaded, I
> dont know how to do it. I have 2 option selected in my page, when I
> select one option and the page automatic reload, and load the other
> select with the information that I selected before, but the focus star
> in the first field that is a Textbox, I want to still when I was before
> the load done.
>
> How I can do that?[/color]

body onload="document.formname.elementname.focus()"

If that doesn't answer your question, please be more clear and supply code or
a URL.

--
--
~kaeli~
Do not taunt Happy Fun Ball!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Nacho
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Focus after submit


Hello Kaeli, thanks for your answer but that's not the question.. I'm
going to explain the problem..

I have a page with some textbox and option select and when i captured
the option select the second option select is loaded, but the setfocus
It goes to the first textbox that is in the page not in the select
option that I captured...

I hope had been explain...

Sorry for my english..

Nacho

kaeli
Guest
 
Posts: n/a
#4: Jul 23 '05

re: Focus after submit


In article <1116532710.050962.49580@f14g2000cwb.googlegroups. com>,
mikicazares@yahoo.com enlightened us with...[color=blue]
> Hello Kaeli, thanks for your answer but that's not the question.. I'm
> going to explain the problem..
>
> I have a page with some textbox and option select and when i captured
> the option select the second option select is loaded, but the setfocus
> It goes to the first textbox that is in the page not in the select
> option that I captured...[/color]

If you're asking how to focus the select element when the page loads (instead
of the text element), that's what I posted.

If you are asking how to make one option of a select be the one that is
selected, it depends a bit on what you meant by "reloaded".
ASP.NET has controls that retain selections for you.
If you're using another server-side process to make the page, you do it on
the server-side.
If you're doing dynamic selects with all client-side javascript, this might
help you. It selects an option on page load. Modify it to suit your needs.

http://www.ipwebdesign.net/kaelisSpa..._parseUrl.html

I'm not here tomorrow or over weekends. If you need more help before Monday,
feel free to e-mail me.

--
--
~kaeli~
Local Area Network in Australia:... the LAN down under.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

enrique
Guest
 
Posts: n/a
#5: Jul 23 '05

re: Focus after submit


If I understand the problem, it sounds like your page is losing state
whenever it is refreshed. You want it to look the way the user set
things before the refresh. So when you reload the page you need to
either pass the element id of the control you want to set focus to on
the URL, or keep the value in a hidden input field if you are doing a
post. When the page refreshes, you now have the information available
to you.

Does that help?

Closed Thread


Similar JavaScript / Ajax / DHTML bytes