October 1, 201016 yr Hi, I have a huge contact form which I did keep 'tidy' using an accordion style show/hide. However, I've changed that now to have an inline list with hyperlinks which show/hide the divs containing the different sections of the form so the idea is that the user works from left to right through the links till the end of the form..... However, ideally, i'd like a "Next >" link in the bottom right corner of each div to take the user to the next div of the form.....but it's not working. I'm using the same id as the hyperlink - could that be causing the problem? Also - I'd like the first div to be shown on page load....
October 1, 201016 yr The duplicated ID's is probably causing the problem, without looking at it i can't really tell. As for showing the first section on load, you could write a few lines to open that on page load. You could code it to be open by default (probably) or you could code the script to load anchor information on load. This also means you'd be able to link to a specific section of the form by amending the anchor information. For utilising anchors, jQuery History is very useful. http://tkyk.github.com/jquery-history-plugin/
October 1, 201016 yr Author I suspected it could be.....Although when I use a 'back to the top' link, it's duplicated on the page which is why I discarded that idea. I'll have another go at it and come back if I still can't get it working. Thanks for the link.
October 2, 201016 yr Author I've sorted this by giving the 'next' links a different id and duplicating the js code. Now I want to try and do something else.... I'd like an inline 'menu' at the top of the form highlighting which section of the form the user is on i.e. personal details, income details etc..... Anyone know how that can be done?
October 2, 201016 yr I've sorted this by giving the 'next' links a different id and duplicating the js code. Now I want to try and do something else.... I'd like an inline 'menu' at the top of the form highlighting which section of the form the user is on i.e. personal details, income details etc..... Anyone know how that can be done? If you give me 30 mins I'll try mock something up. Although I'm not great with js. EDIT: Is this what you were looking for? <!DOCTYPE HTML> <html> <head> <title>Untitled Document</title> <style> body { font-family: Arial, Helvetica, sans-serif; color: #222; } .menuItem { color: #DDD; } </style> <script type="text/javascript"> function showMenu(selection) { document.getElementById(selection).style.color = '#000'; } function hideMenu(selection) { document.getElementById(selection).style.color = '#DDD'; } </script> </head> <body> <form action="#" method="post"> Currently Selected: <span id="txtboxMenu" class="menuItem">Text Box</span> - <span id="passboxMenu" class="menuItem">Pass Box</span> <br /> <br /> Text Box: <input type="text" name="txtbox" id="txtbox" onFocus="showMenu('txtboxMenu')" onBlur="hideMenu('txtboxMenu')" /> <br /> Password Box: <input type="password" id="passbox" onFocus="showMenu('passboxMenu')" onBlur="hideMenu('passboxMenu')" /> <br /> <input type="submit" name="submit" /> </form> </body> </html>
October 2, 201016 yr Author Hey - I've managed to hash something together but I doubt it's perfect. Have to go out so I'll try that code later - many thanks!
Create an account or sign in to comment