Extending HTML Forms

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Sep 2005
Posts: 12
Reputation: md_salman is an unknown quantity at this point 
Solved Threads: 0
md_salman md_salman is offline Offline
Newbie Poster

Extending HTML Forms

 
0
  #1
Feb 1st, 2007
I am trying to create an HTML form in which user will enter different items (he wants to purchase) in text fields. One text field is used for one item. Now it is not known in advance how much items the user will purchase so we cannot decide the total text fields required in advance. Is is possible to increase the number of text fields (using JavaScript) one by one if the user requires more fields.
Bye
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: Extending HTML Forms

 
0
  #2
Feb 1st, 2007
Yes is the answer, this should get you started a very very basic solution but enough to show you what you need to be looking at to acheive your goal. check out http://www.w3schools.com

and get yourself a copy of the javascript anthology published by sitepoint ISBN 0-9752402-6-9

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. var instance = 0;
  5.  
  6. function newTextBox(element)
  7. {
  8. instance++;
  9. var newInput = document.createElement("INPUT");
  10. newInput.id = "text" + instance;
  11. newInput.name = "text" + instance;
  12. newInput.type = "text";
  13. document.body.insertBefore(newInput, element);
  14. }
  15. </script>
  16. </head>
  17. <body>
  18. <input type="button" id="btnAdd" value="New text box" onclick="newTextBox(this);" />
  19. </body>
  20. </html>
Last edited by hollystyles; Feb 1st, 2007 at 9:51 am.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 1
Reputation: yasminou is an unknown quantity at this point 
Solved Threads: 0
yasminou yasminou is offline Offline
Newbie Poster

Re: Extending HTML Forms

 
0
  #3
Nov 9th, 2007
Hello,

the script is exactly what I was searching but I still have a problem.
How can I get the information that people wrote in the text field ? I've tried to put into a <form> but get an error msg.

Can you help ?

Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: Extending HTML Forms

 
0
  #4
Nov 9th, 2007
Only if you tell me what the error message is, and post your current code in code tags. I don;t know how crystal balls work unfortunately

1. what is the action attribute set to in your form tag?
2. What server-side technology are you using? CGI ? ASP? ASP.NET? PHP? all have their different methods for retreiving the POST data from a submitted HTML Form.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC