Forums

validation selection of radio buttons

dave 28 Feb, 2009
First I would like to thank you for ChronoForms.

Joomla 1.5.9
3.1 RC2
Tested in: FireFox 2.xx, IE 7
Form page: http://westernmassatv.org/membership/REMOVE/53.html

I am having 2 problems.

My first problem is I have 3 radio buttons, 1 I just want to make sure the customer has ticked, the other 2 are a one or the other and I want to make sure the customer has ticked one I have setup the validation as such (see below) if the customer selects #12 they get the must select one message if they select #11 all is good, am I doing something wrong or is it a bug?

Validation > validate-one-required: Agree_with_waiver,member_type

<INPUT tabIndex="10" type="radio" name="Agree_with_waiver" value="Yes">

<INPUT tabIndex="11" type="radio" value="Individual" name="member_type"> $25.00 Single
	
<INPUT tabIndex="12" type="radio" value="Family" name="member_type"> $40.00 Family


Second problem is if I select no radio button I get the "must select message", I then select one, click the submit button and the only thing that happens is the "must select message" goes away, in order for the message to be sent I need to click the submit button again.

Thank You for your time
Dave G
Max_admin 28 Feb, 2009
Hi dave,

try to put the first radio in a div and the other 2 ones in another div ?

2nd problem is something related to the js code of the validation and is not easy to change at the moment!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dave 01 Mar, 2009
Max

Thanks for the reply.

I did as you recommended with the div tags, no luck. I have gone to plan B and turned off validation on the radio buttons if you come up with another fix please let me know and I'll give it a try.

2nd problem I will wait and see if this is fixed in a future update I personnel would like to see a alert box as I feel it gets the customers attention better, or possible use the Joomla 1.5 built in light box for the warning, it would be nice to have a choice if possible IMHO.

Thanks for looking into this.
Dave G
GreyHead 01 Mar, 2009
Hi Dave,

This works fine with the divs, you may need to add the classes by hand as I have here:
<div>
<INPUT tabIndex="10" type="radio" class='validate-one-required' name="Agree_with_waiver" value="Yes">
 Agree with waiver
</div>
<div>
<INPUT tabIndex="11" type="radio" value="Individual" name="member_type"> $25.00 Single
   
<INPUT tabIndex="12" type="radio" class='validate-one-required' value="Family" name="member_type"> $40.00 Family
</div>
<input type='submit' name=submit' />


Bob

PS You can of course style the validation advice if you want it to get more attention.
[attachment=0]01-03-2009 14-54-53.png[/attachment]
dave 01 Mar, 2009
Bob

WoW!! you're as bad as I am working on a Sunday :-)

Well I don't know what went wrong when I tried it the only difference I see is you added class='validate-one-required' and not to all 3 ? that did work. Can you tell me why I need to add class='validate-one-required' I don't use the form wizard I create my forms by hand.

It's not so much the visibility as it is the the 3 required radio buttons are the last required items in the form and if the customer does not select one, they then see the warning, they then select it the warning at the time does not go away, they then move down to the submit button click it, at that time the warning goes away BUT the form is not sent you need to click the submit button again to send.
Most customers as I am finding out do not try re-clicking the submit button they just email me and say the form is not working.

Thanks for clarifying the fix.

Dave G
GreyHead 01 Mar, 2009
Hi Dave,

The validation code works by checking the classes of the inputs and validate-one-required is the code for the "look for the immediate parent of this element and check that at least one of it's children is checked". Hence the need for the div and the class.

The Validation code is a MooTools port of Andrew Tetlaw's "Really Easy Form Validation", you'll find the docs if you Google both on Andrew's Dexagogo site and in a sometimes useful Google Group.

The MooTools port isn't perfect and misses a couple of useful chunks of functionality but works most of the time.

I agree with you about the extra click - I have a similar problem at the moment. If I find a minute or six I'll take a dig and see if I can see what causes it. For the moment I just add a polite help message about clicking again if it doesn't submit first time.

Bob

PS I think it's probably possible to style the validation messages into a floating window - but that's another project for a rainy day.
pat01 05 Mar, 2009
Hi Bob

It would be great if you culd find a solution here. I have the same problem.

Most of all, the visitors need to klick on the first radio button.
If they click on any other one the message never goes away...

Regards
Patrick
Max_admin 05 Mar, 2009
Hi Patrick,

do you have all the radios inside one container ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
pat01 02 Jun, 2009
Hi Max

I'm very sorry for the late reply. For some reason I did not receive the notification email upon your answer.

Anyway, using the latest version of CF, the problem does not exist anymore. 😀

Thanks for your help!

Patrick
This topic is locked and no more replies can be posted.