Post by jerry on May 10, 2014 23:28:27 GMT -5
Guys,
I'm having all kinds of problems getting a textbox to have the main focus in my program. I've used the textbox method setfocus(), but it does not work. Tried the javascript I found in this forum, also not effective.
What I have is a number of buttons providing "about", "help", etc when clicked on. When run, my program throws up a banner surrounded with buttons, no wait at this point, then it get's to the code below.
If the user enters text and clicks on "ACCEPT" all is well. However if text is entered into the textbox and the user hits <return>, instead of the input being accepted and the program continuing, it's as if the user has clicked on the first button. In this code, it's as i the "Pricers" button was pressed. Not what I need done.
Clearly I need a way to setfocus() on the textbox, so that when the user hits <return> the text is taken from the textbox and program flow starts after the wait as it should.
I just haven't found a way. Any suggestions?
in the begining of the program, just a string o buttons:
html "<br>"
button #a0, " Pricers ", [supportedPricers]
button #a1, " Help ", [help]
button #a2, " About ", [about]
button #a3, " Logout ", [logout]
html "Enter Part Number"
textbox #gettext, ""
'#gettext setfocus()
html "<script type='text/javascript'>document.getElementById('#gettext').focus()</script>"
link #action, "ACCEPT", [gottext]
wait
[gottext]
partnumber$ = #gettext contents$()
--- rest of program ---
I'm having all kinds of problems getting a textbox to have the main focus in my program. I've used the textbox method setfocus(), but it does not work. Tried the javascript I found in this forum, also not effective.
What I have is a number of buttons providing "about", "help", etc when clicked on. When run, my program throws up a banner surrounded with buttons, no wait at this point, then it get's to the code below.
If the user enters text and clicks on "ACCEPT" all is well. However if text is entered into the textbox and the user hits <return>, instead of the input being accepted and the program continuing, it's as if the user has clicked on the first button. In this code, it's as i the "Pricers" button was pressed. Not what I need done.
Clearly I need a way to setfocus() on the textbox, so that when the user hits <return> the text is taken from the textbox and program flow starts after the wait as it should.
I just haven't found a way. Any suggestions?
in the begining of the program, just a string o buttons:
html "<br>"
button #a0, " Pricers ", [supportedPricers]
button #a1, " Help ", [help]
button #a2, " About ", [about]
button #a3, " Logout ", [logout]
html "Enter Part Number"
textbox #gettext, ""
'#gettext setfocus()
html "<script type='text/javascript'>document.getElementById('#gettext').focus()</script>"
link #action, "ACCEPT", [gottext]
wait
[gottext]
partnumber$ = #gettext contents$()
--- rest of program ---