| | |
Javascript web forms without click
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Oct 2008
Posts: 9
Reputation:
Solved Threads: 0
Normally, arriving at a PHP page with a data entry web form, you would have to click on any field you wish to change to go into data entry mode (the first field or any successive one), and then you can tab between fields (TAB to go forward or ALT-TAB to go back one or so) and then to activate the submit button you would only need to press enter.
What I'm wondering, is if upon arrival at the page you can bypass any mouse click at all, and just use the tab key and enter data for any field (perhaps just 2 out of 10), and then still requiring the enter key to submit the data.
So basically this would eliminate the need to click on any field first to start the data entry mode,
Is this possible? And also, if this is an easy fix, can I choose which field is highlighted first (where the tab key would point to) and perhaps add some coloration highlight to the active field at the time?
Thanks
The form code would start out (in the old manual way) as something like this:
What I'm wondering, is if upon arrival at the page you can bypass any mouse click at all, and just use the tab key and enter data for any field (perhaps just 2 out of 10), and then still requiring the enter key to submit the data.
So basically this would eliminate the need to click on any field first to start the data entry mode,
Is this possible? And also, if this is an easy fix, can I choose which field is highlighted first (where the tab key would point to) and perhaps add some coloration highlight to the active field at the time?
Thanks
The form code would start out (in the old manual way) as something like this:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<form action="depts.php" method="POST"> Department number: <input type=text name="num" value="" size="2"> Description: <input type=text name="text" value="" size="20"><br> Starting Sales: <input type=text name="startr" value="" size="12"> Ending Sales: <input type=text name="endr" value="" size="12"> Purchases: <input type=text name="purch" value="" size="12"><br> Credits: <input type=text name="credit" value="" size="12"> Book Figure: <input type=text name="book" value="" size="12"> Cost Markup % <input type=text name="factor" value="" size="5"> <input type=submit name="submit" value="submit"><br><br>
Last edited by frank754; Nov 29th, 2008 at 1:28 pm.
You have to just set the focus to the first input box after the page is loaded. And that can be done by simple javascript code.
Write an event-handler for <body onload="setInputFocus()">
And your HTML code will also change a lil bit as you have to set a id for first input you want to focus onload.
Write an event-handler for <body onload="setInputFocus()">
javascript Syntax (Toggle Plain Text)
function setInputFocus() { var focusEl = getElementById('1_input'); focusEl.focus(); }
And your HTML code will also change a lil bit as you have to set a id for first input you want to focus onload.
html Syntax (Toggle Plain Text)
<form action="depts.php" method="POST"> Department number: <input id="1_input" type=text name="num" value="" size="2"> . . . .
When you think you have done a lot, then be ready for YOUR downfall.
•
•
Join Date: Oct 2008
Posts: 9
Reputation:
Solved Threads: 0
Thanks a lot, I had to play with it a bit, but got it to work just fine. In the head section I put:
And then changed the form below to add the element name as you mentioned.
I also did a color mod which I found on this page:
http://www.netmechanic.com/news/vol5...cript_no19.htm
So all is looking great!
Appreciated your quick reply
Frank
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script type="text/javascript"> function SetInputFocus() { document.getElementById('1_input').focus(); } window.onload = SetInputFocus; </script>
I also did a color mod which I found on this page:
http://www.netmechanic.com/news/vol5...cript_no19.htm
So all is looking great!
Appreciated your quick reply
Frank
![]() |
Similar Threads
- To align the whole web page in the centre of the page (ASP.NET)
- Unwanted data injected into datagrid textbox (ASP.NET)
- ASP.Net Security 101 Part 1 (ASP.NET)
- Product List and Order Form Submit (JavaScript / DHTML / AJAX)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- VB6 submit button sends information to BBChat (Visual Basic 4 / 5 / 6)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: get size of image file in K , Kb and restrict uplaod if file size is above speci
- Next Thread: Problem Using innerHTML
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box bug calendar cart checkbox class codes column createrange() css cursor date debugger decimal design dom download dropdown element embed enter error explorer firefox focus form frameworks getselection google gwt hiddenvalue hint html htmlform ie7 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 object onmouseover paypal php player position post problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select shopping size software sql text textarea toggle unicode w3c website window windowofwords windowsxp wysiwyg





