Results 1 to 2 of 2

Thread: Saving form values with JavaScript

  1. #1
    Join Date
    Jun 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Saving form values with JavaScript

    I'm trying to add another field to a form on a site using Greasemonkey and save the value of whichever radio button is clicked.

    Right now I have a "yes" and "no" button with the values 1 and 0.

    I have a global variable in my script. formval = 1;

    checkRadio() is a function to check which radio button is clicked.

    When the user clicks submit, I want it do this: "formval = checkradio[0].value"

    However, since at the top the global variable has formval = 1, each time the page is refreshed, formval will go back to 1. I want it to stay 0 if I click 0.

    Does anyone have any help?
    Last edited by itsjareds; 06-08-2008 at 07:42 PM.

  2. #2
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    http://www.htmlgoodies.com/beyond/ja...le.php/3470821

    This is a pretty good tutorial on using cookies to save variables. Keep in mind that this also depends on the user...for instance, do they even have cookies enabled? Also, this is only saving the variable for said user....if another user views the site, it starts with the global declaration for them.
    Verzeihung!

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
  •