Irish SEO,  Marketing & Webmaster Discussion
 
Affiliates get Paid On Results, Click Here!
 

Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help


Notices

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 23-07-2008, 12:53 AM
Tom Tom is offline
Wannabe Geek
 
Join Date: Jan 2007
Location: Kildare, Ireland
Posts: 172
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Tom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to behold
Default Javascript help needed

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.
__________________
MGS Web Design - Web Design Kildare, Web Design Ireland

Last edited by Tom; 23-07-2008 at 02:12 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 23-07-2008, 12:59 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 1,937
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
louie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud of
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

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
:. Directory Submission Directory Submission
:. News & Press Release Ireland GiveItSocks.com
:. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories
:. I Have 2 Find It Directory SEF Directory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 23-07-2008, 02:02 PM
Tom Tom is offline
Wannabe Geek
 
Join Date: Jan 2007
Location: Kildare, Ireland
Posts: 172
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Tom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to beholdTom is a splendid one to behold
Default

Thanks Louie, I've got it working peachy now (almost) after a lot of head scratching and head banging.
__________________
MGS Web Design - Web Design Kildare, Web Design Ireland
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 23-07-2008, 02:27 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 1,937
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
louie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud of
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

if you show us what you have we might be able to improve it for you.
__________________
:. Web Design & Development Web Design Ireland
:. Search Engines Optimization Search Engines Optimization
:. Directory Submission Directory Submission
:. News & Press Release Ireland GiveItSocks.com
:. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories
:. I Have 2 Find It Directory SEF Directory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 12:29 AM.


Powered by: vBulletin Version 3.7.2, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.

Search Engine Friendly URLs by vBSEO 3.2.0