How to set a cursor to a specific textbox

8 views
Skip to first unread message

big_earl

unread,
Nov 12, 2009, 8:33:58 AM11/12/09
to Nitrogen Web Framework for Erlang
Hello,
I have a form with a couple of text boxes and a OK and Cancel button.
In the postback function I validate the data in the textboxes and if
data in 1 text box is wrong I would
like to set the cursor in this box and select the text.
How would I go about doing this?

BR,
/Erland

big_earl

unread,
Nov 19, 2009, 7:47:28 AM11/19/09
to Nitrogen Web Framework for Erlang
I have been trying to find a solution, with something like this:
#tablecell {
body=[
#button { id=addButton,
text="OK",
postback=add_stuff},
#event { type=click,
actions=#script { script="document.getElementById(\"nameBox
\").focus();" } }
]}

where nameBox is a textbox. But this does not work.

What am I doing wrong?
BR,
/Erland.

big_earl

unread,
Nov 23, 2009, 10:16:44 AM11/23/09
to Nitrogen Web Framework for Erlang


I managed to figure it out

#tablecell {
body=[
#button { id=addButton,
text="OK",
postback=add_stuff},
#event { type=click,
actions=#script { script="obj('nameBox').focus
();" } }
]}

Br,
/Erland
Reply all
Reply to author
Forward
0 new messages