It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

simple form question

simple form question

Postby nagyagi on Fri Jan 11, 2008 3:27 pm

I'm new to JS and I need some help with a form that I'm working on.
I have form with a checkbox that I need submitted if it's clicked on without having to hit a submit button.

I have used it on a drop down, but it doesn't seem to work on the checkbox

Code: Select all
<form id="tax" name="tax" method="post" action="">
Sales tax charged? <input name="salesTax" type="checkbox" value="Y" checked="checked" onChange="document.forms[0].submit()">
</form>


What do I need to do to make it work?
nagyagi
 
Posts: 11
Joined: Sun Nov 18, 2007 4:14 pm

Postby flabbyrabbit on Fri Jan 11, 2008 3:38 pm

Well first of you need to give the form a destination, the action variable is empty.

Flabby Rabbit
Image
User avatar
flabbyrabbit
500+ Club
 
Posts: 706
Joined: Thu Jan 25, 2007 1:10 pm
Location: Midlands, England

Postby nagyagi on Fri Jan 11, 2008 3:55 pm

It's processed on the same page (PHP).
nagyagi
 
Posts: 11
Joined: Sun Nov 18, 2007 4:14 pm

Postby flabbyrabbit on Fri Jan 11, 2008 3:57 pm

don't you still need to put the page in?? If it is still passing it to the right page, in what way doesnt it work??

Flabby Rabbit
User avatar
flabbyrabbit
500+ Club
 
Posts: 706
Joined: Thu Jan 25, 2007 1:10 pm
Location: Midlands, England

Postby nagyagi on Fri Jan 11, 2008 4:13 pm

I put the page in, just to be sure. It still didn't work.
BTW, if it's left blank then it uses the same page to submit the form to.

In what way it doesn't work? I uncheck the checkbox and it's not reloading the page.
What I need is if a change is made to the checkbox then submit the form to the same page, get value and update DB and redisplay the whole page.
I just need help with the JS part. The HTML/PHP/MYSQL part I can handle.

Thx.
nagyagi
 
Posts: 11
Joined: Sun Nov 18, 2007 4:14 pm

Postby flabbyrabbit on Fri Jan 11, 2008 11:35 pm

So it sends the information before its changed the value??

Flabby Rabbit
User avatar
flabbyrabbit
500+ Club
 
Posts: 706
Joined: Thu Jan 25, 2007 1:10 pm
Location: Midlands, England


Who is online

Users browsing this forum: No registered users and 6 guests