Dropdown box error when option=Required

fchlarie 19 Jan, 2009
Hello to you all,

I'm new to Chrono Forms and used a form now for registration to an event. I have encountered one problem. My form contains several dropdown boxes. Each dropdown box is required. Everyone goes well when you choose an option that is different from the first value.

If you leave the dropdown box unchanged or you select the first value, I always get the message "Please make a selection".

Here is a sample code of one dropdown box.
<div class="form_item" >
<div class="form_element cf_dropdown"><label class="cf_label">Accompanied by partner?</label>
<select name="select_4" size="1" id="select_4" class="cf_inputbox validate-selection">
<option value="Yes">Yes</option><option value="No">No</option>
</select></div>
<div class="clear"> </div>
</div>

In this example, on the website it is never possible to select the value "Yes"
http://www.chlarie.com/index.php?option=com_chronocontact&Itemid=8&lang=nl

Any help is higly appreciated.

Regards,
Francis
GreyHead 19 Jan, 2009
Hi Francis,

I was looking at this last week. The problem is that with a select box -as far as JavaScript can tell - the currently displayed option is always "selected". So, 'required' has no meaning as it's always true.

I can't think of any way around this except to make the first (or the default) option something like "-?-" with a value of zero. Then you can check that some other selection has been made.

Bob
fchlarie 19 Jan, 2009
thank you very much. I'll try that.
Will this bug be solved in next releases?
GreyHead 19 Jan, 2009
Hi fchlarie,

Sorry but Nope, it's not a ChronoForms bug, just the way that HTML and JavaScript work.

Bob
0be1 04 Feb, 2009
Actually I believe it may be a Chronoform bug and this is why I say that. I had the same problem with a form and tried and tried to get it to work. Here is what I found out.

When I originally submitted the form I forgot to properly label a couple of my dropdowns (using dreamweaver it defaulted them to select and select2) and copied and pasted my code under the forms tab. Here is what my last field showed up as under the email templates section:

<td>Contact me by:</td>
<td><span>{select2}</span></td>

For brevity purposes I am only submitting this one piece as all other fields had the same problem. I had then made my corrections in dreamweaver and copied and pasted the code again. The code matched under the form code section, however the code never was updated in the emails template section. I kept wondering why when I submitted the test email of filling out the form it kept saying select2 and searched everywhere for it and finally found it.

As soon as I made sure that my dropdown boxes match on both the email template and the form code tab matched EXACTLY everything worked perfect.

I hope this made sense and if you need any further explanation on the bug, please reply to this post and I will do my best to explain it some more.

btw, thanks for a great product, and once we get the testing done, we are going to pay for the component. Thanks for making my Joomla experience a whole lot better.

Sincerely,

Shawn - aka 0be1
Max_admin 04 Feb, 2009
Hi Shawn,

If your email template has even "1" character then Chronoforms will NOT even try to make a new template for the form, it assumes that this code is your own template and will not try to do anything for it, so after the first template generated you should pay attention to change it every time you change your form code!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
picsoung 13 Feb, 2009
hey๐Ÿ™‚
i think i got the same problem
imagine a select box with 3 values
Apple
Microsoft
Nokia

Apple is the first element of the list... but if i would like to select this element...
it's say "Please make a selection"...๐Ÿ˜Ÿ

this field is required..

So what was the solution ?
Plus : values in the select object are dynamiqly (:S) added :
<select name="objectcat" size="1" id="objectcat" class="cf_inputbox validate-selection">
		<?php //this code permit to use dynamic access to category list
			$query= "SELECT * FROM `#__itemcat` ORDER BY `name` ;";
	$db->setQuery($query);
	$db->query();
	$result=$db->loadRowList();
	
	foreach($result as $cle =>$val): ?>			 	
		<option value=".$val"><?php echo stripslashes($val[1]); ?></option>
	<?php endforeach; ?>
		</select>


thanks for your help๐Ÿ™‚
Max_admin 13 Feb, 2009
Hi picsoung,

you must add an empty option to the top of the list for the validation to work fine:

<option value="">please select</option>


Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
picsoung 14 Feb, 2009
working good๐Ÿ™‚
This topic is locked and no more replies can be posted.