Instant value Checkboxes

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
jbstone713
Forum Newbie
Posts: 14
Joined: Wed Mar 02, 2005 10:01 pm

Instant value Checkboxes

Post by jbstone713 »

Is there a way to instantly store a value in a checkbox without clicking submit (just check it)?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Do you mean like the checkbox is already checked when you go to the page?

Be a bit more specific
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

whatever it is.. it ain't php code.. Moved to Client-side.
jbstone713
Forum Newbie
Posts: 14
Joined: Wed Mar 02, 2005 10:01 pm

Post by jbstone713 »

No, I know that I can specify a checkbox to be checked or unchecked when the page first loads. I mean when a person actually clicks a checkbox, the value is instantly stored. I have a form that has a hyperlink that "adds favorites" and returns to the same page. If a user selects a checkbox(without clicking submit) and clicks on the "adds favorites" link, the checkbox is now unchecked. However, if a user selects a checkbox, then he clicks submit(and he got returned to this form because of user error), and he then clicks on an "adds favorites" link, the checkbox will remain checked. I built in form handling to ckeck for required fields. The values of a checkbox will only be passed if the user selects a checkbox, and then clicks submit. If he selects a checkbox and doesn't click submit, there is no value. Any idea how I can instantly store a value the instant a checkbox is selected?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not just have the "adds favorites" link submit the form?
jbstone713
Forum Newbie
Posts: 14
Joined: Wed Mar 02, 2005 10:01 pm

Post by jbstone713 »

I thought about that, but I have an add favorites link for each individual item that is displayed on the same page. Each link works only for that particular item. If a user is scrolling down, checks a box(but doesn't want it in his favorites, then decides to add a different item into his favorites further down the page, the checked checkbox that he clicked above will dissappear! That is why I need a way to instantly store a value once a checkbox is clicked.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

so you have a form for each check box? Why not make them one large form so they can add and remove "favorites" as they wish?
jbstone713
Forum Newbie
Posts: 14
Joined: Wed Mar 02, 2005 10:01 pm

Post by jbstone713 »

I already have one large form, but combined I also need to have individual links to add and remove "favorites" as they wish? I need this to be set up this way so the user only has access to certain items at certain times. I don't want to have a page displaying all items. They must be done this way.
Post Reply