Search the web
Sign In
New User? Sign Up
JS-Jive · The premiere Yahoo! Javascript Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Making radio button submit form   Message List  
Reply | Forward Message #21090 of 21091 |
Re: Making radio button submit form

You are making a big mistake.

Just do a onclick="Ship_Option(this.form)" on each item

And inside the function
function Ship_Option(form)
{
form.submit();
}

You don't need to re-write the value in the option to send it. As you click,
that option becomes checked and is sent in the submit.


And FYI, form.service is a collection, an Array, so form.service.value will
do nothing.
That would only work if you had just one radio button named service.

Cheers
Rafael



On Fri, Feb 20, 2009 at 19:39, Bob <helldrivers@...> wrote:

> ----- Original Message -----
> From: "tmallan"
> > This form allows a customer to choose a shipping option. While it
> > submits the form, no matter which button is selected, the same value
> > is always submitted.
> > Thanks for any help.
> >
> > The code:
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > <script language="JavaScript" type="text/javascript">
> > function Ship_Option(Form, Value) {
> > Form.service.value = Value;
> > Form.submit();
> > }
> > </script>
> >
> > <form method="post" action="ship.html">
> > <input type="radio" name="service" value="9"
> > onfocus="Ship_Option(this.form, 9)">UPS Ground<br>
> > <input type="radio" name="service" value="10"
> > onfocus="Ship_Option(this.form, 10)">UPS 3 Day Select<br>
> > <input type="radio" name="service" value="11"
> > onfocus="Ship_Option(this.form, 11)">UPS 2 Day Air
> > </form>
>
> Hi tmallan,
> This group doesn't seem to be very active of lately, though there seems to
> be quite a few group members.
>
> I'm a newbie at javascript myself, but when I tried your code, it didn't
> pass any value at all, for me. I was using PHP to get the $_POST['service']
> value passed.
>
> I guess you are trying to do this without using a Submit button, which
> would be nice.
>
> Hope some more experienced members can help you.
> Regards, Bob E.
>
>
>


[Non-text portions of this message have been removed]




Fri Feb 20, 2009 10:57 pm

porrak
Offline Offline
Send Email Send Email

Forward
Message #21090 of 21091 |
Expand Messages Author Sort by Date

This form allows a customer to choose a shipping option. While it submits the form, no matter which button is selected, the same value is always submitted. ...
tmallan
Offline Send Email
Feb 18, 2009
10:46 pm

... From: "tmallan" ... Hi tmallan, This group doesn't seem to be very active of lately, though there seems to be quite a few group members. I'm a newbie at...
Bob
robert_dehoure
Offline Send Email
Feb 20, 2009
10:40 pm

You are making a big mistake. Just do a onclick="Ship_Option(this.form)" on each item And inside the function function Ship_Option(form) { form.submit(); } You...
Rafael Raposo
porrak
Offline Send Email
Feb 20, 2009
10:57 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help