SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: HTML Form Question

  1. #1
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML Form Question

    Hi guys,

    I have a form that allows a user to search, when submitted it displays the information below the form. The users have requested that after they click Submit, that the information they input into the search text area, remains there after they click submit. They would also like to have a "Clear" button to remove the text if needed to input additional searches.

    How would I go about setting this up?

    Thanks,
    Aaron

  2. #2
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,473
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hi there,

    Welcome to the forums!

    You can do this using JavaScript.
    The exact code you need would depend on exactly what elements you have in your form.
    Here is a good tutorial: http://www.javascript-coder.com/java...set-form.phtml

    Maybe you can have a look at that and post back here if you have any questions.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    15,823
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Depending on which server side language you are using with the form it is simply a matter of setting the form field values from the fields passed with the form. Only the clear button functionality would require JavaScript (although JavaScript could be used to process the form without having to reload the page.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,473
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Oops, I missed the first part of the question.
    Thanks felgall!
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

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
  •