Results 1 to 3 of 3

Thread: How to populate the text field in a button click.

  1. #1
    Join Date
    Sep 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to populate the text field in a button click.

    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.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks for your help.

    Hi,

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

    Thanks,
    Sowjanya

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •