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]