Forums

Validation & Radio Buttons

RobertPGH1981 31 Jul, 2008
I have two questions. I apologize if this is elementary to everyone but this is my first time using Chrono and I am new to all this.

1.) I have been looking over several posts and still dont fully understand how to validate Radio Buttons. I currently have a two but will be adding more later. Here is my HTML. This code is located under the Form Code > Form HTML.

<H1><u> Life Group Sign Up </u></H1><br><br>

First Name:   <input name="fname" value="" type="text"><br /><br />
Last Name:   <input name="lname" value="" type="text"><br /><br />
Phone:   <input name="phone" value="" type="text"><br /><br />
E-mail:   <input name="email" value="" type="text"><br /><br />

<div class="radioQuest">
<input type="radio" name="group" value="New Horizons"> New Horizons 
<input type="radio" name="group" value="New Beginings" class="validate-one-required"> New Beginings <br /><br />
</div>

<input name="submit" value="Submit" type="submit"> 
</TABLE>


On the validation tab inside joomla I place class="radioQuest" on the 12- validate-one-required . It still allows me to submit the form when the options are blank. It keeps erasing the "radioQuest" when I save so I know I am doing something wrong.

2.) I want to add the persons name inside the subject line. I want the subject line to say, New Lifegroup Sign Up: "fname" "lname"
GreyHead 31 Jul, 2008
Hi RobertPGH1981,

Q2 is simple and has been answers recently - search the forums on 'subject' and I think you will find the thread OK (NB advanced search lets you search all the forums).

Q1 you wrote "On the validation tab inside joomla I place class="radioQuest" on the 12- validate-one-required . "

Don't do this - that field only takes fieldnames and this isn't a field name. You can leave that box empty as you already have the class in the last radio input. That should be enough.

Bob
RobertPGH1981 31 Jul, 2008
Currently my code still does not validate. Do I place this class in the HTML section or should I place it in the onSubmit section. Ihave provided a screenshot of how I currently have it setup.

Currently I have all my code in the HTML section. Here is the screenshot. [attachment=1]validateRadio.JPG[/attachment]
Here is a screenshot of the validation tab. [attachment=0]validationTab.JPG[/attachment]
GreyHead 31 Jul, 2008
Hi RobertPGH1981,

That all looks Ok to me - is the form on-line aso I can take a look?

Bob
RobertPGH1981 31 Jul, 2008
The form is feeding my site properly and the other validations are working but it still does not validate my radio buttons. I am lost for words now. 😟
RobertPGH1981 31 Jul, 2008
How do I make the form start with an option selected?
GreyHead 31 Jul, 2008
Hi RobertPGH1981,

Add selected="selected" in the option tag.

Bob

Later: sorry I read your email out of context. This is correct for an option in a select group. For radio buttons or checkboxes you need checked="checked"
RobertPGH1981 31 Jul, 2008
Maybe this could be the problem. I have a menu item that is a link directed the user to the form. Here is how I am linking to the form. Maybe that could be the issue. Here is a screenshot of the form. its a link on the homepage that takes you directly to the Form.

[attachment=0]menuItem.JPG[/attachment]
Max_admin 31 Jul, 2008

Maybe this could be the problem. I have a menu item that is a link directed the user to the form. Here is how I am linking to the form. Maybe that could be the issue. Here is a screenshot of the form. its a link on the homepage that takes you directly to the Form.



Hi Robert, you are saying that the form redirect may get the selected value of the dropdown doesnt work ? cant get it!

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
RobertPGH1981 31 Jul, 2008
My validation for my radio buttons are not working. Greyhead looked over my code and said it looked fine. It still does not work and I thought it may have something to do with the way I setup the links. I took a screenshot of the menu item that I have a form linked to thinkning this may be part of the problem. I wasent sure if that could be an issue because this is my first time using the product.
GreyHead 31 Jul, 2008
Hi Robert,

You must have a div around the radio button group. You have
E-mail:
<input class="required validate-email" type="text" value="" name="email" style="background-color: rgb(255, 255, 160);"/>
<br/>
<br/>
<input type="radio" value="New Horizons" name="group" select="selected"/>
New Horizons
<input class="validate-one-required" type="radio" value="New Beginings" name="group"/>
New Beginings
<br/>
<br/>
<input type="submit" value="Submit" name="submit"/>
make that
E-mail:
<input class="required validate-email" type="text" value="" name="email" style="background-color: rgb(255, 255, 160);"/>
<br/>
<br/>
<div>
<input type="radio" value="New Horizons" name="group" checked="checked"/>
New Horizons
<input class="validate-one-required" type="radio" value="New Beginings" name="group"/>
New Beginings
</div>
<br/>
<br/>
<input type="submit" value="Submit" name="submit"/>
Otherwise the validation code can't see where the group starts and ends.

Bob

PS You need checked="checked" to set a default value - but if you set a default value then 'select-one-required' will always be true so you can forget about that validation.
RobertPGH1981 31 Jul, 2008
<input class="required validate-email" type="text" value="" name="email" style="background-color: rgb(255, 255, 160);"/>
<br/>
<br/>
<div>
<input type="radio" value="New Horizons" name="group" checked="checked"/>
New Horizons
<input class="validate-one-required" type="radio" value="New Beginings" name="group"/>
New Beginings
</div>


This code produces and extra text field. So I take out the extra text field and place validate-email in the input for the radio buttons. Now it tries to validate for the email address. This is something more than we had before. Atleast it is trying to validate something. Now I need it to validate for a radio button instead of an email address. When I try to replace validate-email with validate-group it does nothing.
RobertPGH1981 31 Jul, 2008
It never worked with validate-selection or validate-one-required
Max_admin 31 Jul, 2008
Hi Robert,

please post me here your SELECT filed code and your CHECKBOXES group code and I will tell you where is the problem!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 31 Jul, 2008
Hi Robert,

As far as I can see your form is validating perfectly OK - what do you think the problem is????

Bob
RobertPGH1981 31 Jul, 2008
The other fields are working fine its the radio buttons. I recently changed it to checked on the form. But when i would take out the checked coding the validation never worked. All the other fields are working fine. But as far as the radio buttons I think I will automatically settle for the default. I really appretiate your time you put forth in helping me out trying to validate the radio buttons. Everything is working find now that I eliminated the validation on the radio buttons and defaulted it to checked.
GreyHead 01 Aug, 2008
Hi RobertPGH1981,

As I said earlier, there is nothing to validate on the radio buttons.

You have set a default value so that New Norizons will be checked unless the user checks New Beginnings. One or the other is always selected so 'validate-one-required' always tests true and will never show an error message.

Bob
RobertPGH1981 01 Aug, 2008
I was aware that if I had this checked it would not validate because it would always be checked. The validation was not working when I didn't include the check within the form. I included the check because I couldn't get the validation working. It never validated when it wasen't checked. Thank you for your help I am just going to settle for what I have now.
Max_admin 01 Aug, 2008
Hi Robert,

I took your 2 radio buttons to my test form on the new release here and they are working very well, nothing changed in the validation logic so they should work with you actually!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 01 Aug, 2008
Hi Robert,

Just to confirm Max's comment - as long as the div is added the validation works perfectly well.

Bob
GreyHead 01 Aug, 2008
Hi Robert,

Just to confirm Max's comment - as long as the div is added the validation works perfectly well.

Bob
RobertPGH1981 01 Aug, 2008
Here is my code in the HTML

<H1><u> Life Group Sign Up </u></H1><br><br>

First Name:   <input name="fname" value="" type="text"><br /><br />

Last Name:   <input name="lname" value="" type="text"><br /><br />

Phone:   <input name="phone" value="" type="text"><br /><br />

E-mail:   <input name="email" value="" type="text"><br /><br />

<div>
<input class="validate-one-required" type="radio" value="New Horizons" name="group" /> New Horizons

<input type="radio" value="New Beginings" name="group"/> New Beginings
</div>

<br/>
<br/>
<input type="submit" value="Submit" name="submit"/> 


Validation Tab
[attachment=1]validationTab.JPG[/attachment]

Validate Code
[attachment=0]validateRadio.JPG[/attachment]

http://testing03.thebridgepgh.com/index.php?option=com_chronocontact&chronoformname=Groups&Itemid=11
GreyHead 01 Aug, 2008
Hi RobertPGH1981,

There doesn't seem to be a question there . . .

If you are still trying to get the validation to work what I did was to put 'group' in the 'validate-one-required' box on the validation tab and have no class attributes in the tags themselves.

If you want to put the class attributes in manually then they need to go in the last radio button (or checkbox) - see my earlier post for the code.

Bob
RobertPGH1981 01 Aug, 2008
I am just going with checked. I cant get the validation to work. I know you can do it but I have to be doing something wrong. I cant figure it out.

Here is my code with group added on the validation tab.

<H1><u> Life Group Sign Up </u></H1><br><br>

First Name:   <input name="fname" value="" type="text"><br /><br />

Last Name:   <input name="lname" value="" type="text"><br /><br />

Phone:   <input name="phone" value="" type="text"><br /><br />

E-mail:   <input name="email" value="" type="text"><br /><br />

<div>
<input type="radio" value="New Horizons" name="group" />
New Horizons
<input type="radio" value="New Beginings" name="group"/>
New Beginings
</div>

<br/>
<br/>
<input type="submit" value="Submit" name="submit"/> 


Here is my code without group added on the validation tab.

<H1><u> Life Group Sign Up </u></H1><br><br>

First Name:   <input name="fname" value="" type="text"><br /><br />

Last Name:   <input name="lname" value="" type="text"><br /><br />

Phone:   <input name="phone" value="" type="text"><br /><br />

E-mail:   <input name="email" value="" type="text"><br /><br />

<div>
<input type="radio" value="New Horizons" name="group" />
New Horizons
<input class="validate-one-reguired" type="radio" value="New Beginings" name="group"/>
New Beginings
</div>

<br/>
<br/>
<input type="submit" value="Submit" name="submit"/> 


None works.
Max_admin 02 Aug, 2008
I tried to test it on your website but you have it checked by default, can test it!!

btw, did you test in FF and IE or which one ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
RobertPGH1981 02 Aug, 2008
I don't know what you are referring to FF, IE? I removed the check out of the radio buttons.

This code actually will try and validate the email address.

<div>
<input class="required validate-email" type="radio" value="New Horizons" name="group" />New Horizons
<input type="radio" value="New Beginings" name="group"/> New Beginings
</div>


[attachment=0]emailValid.JPG[/attachment]

When I try and put the validate-one-required in to replace it will not validate.

<div>
<input class="validate-one-required" type="radio" value="New Horizons" name="group" />New Horizons
<input type="radio" value="New Beginings" name="group"/> New Beginings
</div>


I then moved it to the second line. It still does not work. This is current.

<div>
<input type="radio" value="New Horizons" name="group" />New Horizons
<input class="validate-one-required" type="radio" value="New Beginings" name="group"/> New Beginings
</div>


All I want it to do is make it a requirement to select one radio button.
This topic is locked and no more replies can be posted.