User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 425,906 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,854 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 593 | Replies: 2
Reply
Join Date: Sep 2004
Location: localhost
Posts: 19
Reputation: computerages is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
computerages computerages is offline Offline
Newbie Poster

create text field using ajax

  #1  
Aug 4th, 2008
hi,

I have an HTML form setup. It has several input text fields to enter the data. I also want the user to add more text fields dynamically if he wishes to enter more data. If I do it directly though PHP using loops, I loose the data previously entered in the fields.

I was wondering about implementing Ajax to solve this probelm to generate multiple text fields. I am new to using Ajax technique, and I do not have solid JavaScript background, and I am kind of strugling.

Thanks very much! Any help would be greatly appreciated!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: New York state
Posts: 468
Reputation: ShawnCplus will become famous soon enough ShawnCplus will become famous soon enough 
Rep Power: 5
Solved Threads: 71
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is online now Online
Code Monkey

Re: create text field using ajax

  #2  
Aug 5th, 2008
People are throwing around the word AJAX as if it is synonymous with DHTML.
  1. var container = document.getElementById('the_form_container');
  2. var newfield = document.createElement('input');
  3. newfield.type = 'text';
  4. newfield.id = someCounter+'_suffix';
  5. container.appendChild(newfield);
^ Not AJAX
GCS d- s+:+ a-->? C++(++++) UL+++ P+>+++ L+++ !E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
Reply With Quote  
Join Date: Aug 2008
Posts: 375
Reputation: langsor is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 34
langsor langsor is offline Offline
Posting Whiz

Re: create text field using ajax

  #3  
Aug 6th, 2008
You can use DHTML as mentioned above ... no problem. Or if you want to stick to the ol' familiar PHP looping you can do something like this to keep the value of your form field on page reload ...
<input type="text" name="test" value="<? print $_GET['test'] ?>" />
If page reload is what you mean by loops.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 7:49 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC