PDA

View Full Version : How to populate the text field in a button click.



sowjanya
11-12-2007, 04:36 PM
Hi All,

I have a textfiled, intially it is blank, but there is a button ALL above the text field and when I click the button, the text filed should populate with text that I have in a session.

Can I do that using javascript, i.e. can I populate the text field on the button click with out submitting the whole form, because there are some other text boxes also entered, if I submit the form and populate the form I am loosing all the data in all other fields.

Please help me out.

thanks,
sowjanya.

jscheuer1
11-12-2007, 08:42 PM
Yes, but not in any meaningful way. That is to say, sure the server could pass a value off to the client and the client could populate a field with it via javascript. But what if javascript is disabled? Or, what if an unscrupulous user changes the value first? Anything that the server passes off to the client may be intercepted and changed by an only marginally savvy user.

With about the same amount of work, you should be able to submit the form back to the page itself, carrying along all previously entered values on the server side, while inserting the 'new' session value at the appropriate spot. Virtually bulletproof.

sowjanya
11-13-2007, 02:22 PM
Hi,

Thanks for your help. I used sessions and have solved it.

Thanks,
Sowjanya