SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2005
    Location
    Pittsburgh
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Writing user input to the same page.

    Hi all,

    I am working on a little project for my javascript class and am running into a wall. I have a form with an input and textarea. I want the user to be able to enter text into both and write it to a list on that page. I had the code working, but ran into trouble using standard 'submit'/'reset' input buttons.

    When the user hits 'submit', the info writes to the page, but the page refreshes at the same time, wiping it as there is no backend to write to. The solution I am toying with now is that instead of the standard form input buttons, I have a link that calls the required JavaScript functions (reset/submit) and writes the data to the page. Works great in Safari.... not at all in FireFox.

    Does anyone know why FireFox doesn't like something like this? Are there any other options that you can think of that a new guy like me could be forgetting?

    Thanks in advance!

  2. #2
    SitePoint Addict ALL's Avatar
    Join Date
    Oct 2005
    Location
    South Dakota
    Posts
    215
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    what i always do the check a submittion of a form is in the <form tag there is an attibute called "onSubmit" if you return true to this it will allow the user to send the data if you return false it will not send the data...

    for example:

    <form onsubmit="return false">
    <input type="submit">
    </form>

    this will never submit the form

    <form onsubmit="return true">
    <input type="submit">
    </form>

    this will always submit the form... Just do a if or whatever to check to make sure everything is working right, and if it is return true if nto return false and/or display a messagebox of what is wrong,
    -ALL
    Did I help you?
    You can repay me, support one of my projects (no money needed):
    JavaScript Wiki, Another Web Forum, Paranormal Site

  3. #3
    SitePoint Member
    Join Date
    Nov 2005
    Location
    Pittsburgh
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the tip! I was able to get it working the way I needed it to because of it.

    Much Thanks,
    Vivid


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
  •