This is a discussion on Javascript help needed within the Coding Help forums, part of the Webmaster Help category; I'm trying to create some dynamic form fields using javascript. Basically the user enters some text in the new_option text ...
| |||||||
| Register | Forum Rules | FAQ | Donate | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'm trying to create some dynamic form fields using javascript. Basically the user enters some text in the new_option text field below and when they click the add_option button it adds a populated text field to a form that is already on the page. Anyone know how to do this off hand? Code: <input type="text" name="new_option"> <input type="button" name="add_option" value="Add Option" onClick="xxxx"> When button is pressed the new_options are outputed here as addtional text fields which can then be submitted with the main form. Edit: I've come across an example at http://www.openjs.com/scripts/examples/addfield.php that comes close to what I'm trying to do. Seems like it should work for me, just need to re-write it a bit to suit my needs. Last edited by Tom; 23-07-2008 at 02:12 AM.. |
| |||||
| That example is exactly what you are looking for but require small changes to get the value: Code: //change the function adding an extra field
function addField(field,area,limit,field_value) {
//add value
input.value = field_value;
__________________ :. Web Design & Development Web Design Ireland :. Search Engines Optimization Search Engines Optimization :. Car Parts & Accessories Car Parts :. Cars Ireland Cars Ireland :. I Have 2 Find It Directory SEF Directory |
| ||||
| Thanks Louie, I've got it working peachy now (almost) after a lot of head scratching and head banging. |
| |||||
| if you show us what you have we might be able to improve it for you. |
| Tags |
| javascript, needed |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Javascript loop | louie | Coding Help | 13 | 01-02-2008 08:27 PM |
| Javascript problem | ph3n0m | Coding Help | 1 | 21-06-2007 03:57 PM |
| javascript | 7aken | Coding Help | 1 | 03-04-2007 03:50 PM |
| javascript help | 7aken | Coding Help | 2 | 20-02-2007 05:09 AM |
| Javascript menu bug? | ButtermilkJack | Coding Help | 1 | 15-01-2007 02:21 PM |
| ||||
| | ![]() | |||
| | ||||