Forums

Validation Select Box Error

pixelfrog 11 Jul, 2009
Hi,

I'm having a strange Select Box validation problem. I have 4 forms on my site and 2 out of the 4 validation is working fine.

The other 2 forms the Select Boxes will not validate whatever I do, can't figure it out to save my life, I've tried ever combination of input names etc...

2 working forms with working Select Boxes:

http://67.15.157.11/~kaconewe/index.php?option=com_chronocontact&Itemid=65
http://67.15.157.11/~kaconewe/index.php?option=com_chronocontact&Itemid=18

2 working forms with Select Boxes not validating:

http://67.15.157.11/~kaconewe/index.php?option=com_chronocontact&Itemid=69
http://67.15.157.11/~kaconewe/index.php?option=com_chronocontact&chronoformname=BlueplanetRegistration

Here's the Select Box code for the 2 that work:


<div class="form_item">
<div id="ERROR_SALUTATION" class="clearfix">
<label class="cf_label" style="width: 150px;">Title*</label>
<div align="left" style="margin: -18px 0px 0px 120px;" ><select class="inputSelect required validate-selection" id="select_0" size="1" title="Please select a Title" name="select_0">
<option value="">Please select...</option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Miss">Miss</option>
<option value="Ms.">Ms.</option>

</select> </div>
</div>
</div>




And


<div class="contentFormRightContent">

<div id="ERROR_SALUTATION" class="clearfix">
<label for="SALUTATION" class="inputTextLabel">Title*</label>
<div align="left" style="margin: -18px 0px 0px 120px;" ><select name="SALUTATION" id="SALUTATION" class="inputSelect validate-selection">
<option value="">Please select …</option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Miss">Miss</option>
<option value="Ms.">Ms.</option>
</select></div>
</div>




Here's the Select Box code for the 2 that DON'T work:


<div class="contentFormRightContent">

<div id="ERROR_SALUTATION" class="clearfix">
<label for="SALUTATION" class="inputTextLabel">Title*</label>
<div align="left" style="margin: -18px 0px 0px 120px;" ><select name="SALUTATION" id="SALUTATION" class="inputSelect validate-selection">
<option value="">Please select …</option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Miss">Miss</option>
<option value="Ms.">Ms.</option>
</select></div></div>
</div>


And


<div id="ERROR_SALUTATION" class="clearfix">
<label for="SALUTATION" class="inputTextLabel">Title*</label>

<div align="left" style="margin: -18px 0px 0px 120px;" ><select name="SALUTATION" id="SALUTATION" class="inputSelect required validate-selection">
<option value="">Please select …</option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Miss">Miss</option>
<option value="Ms.">Ms.</option>
</select></div>
</div>




Any ideas? Any help would be greatly appreciated!


Paul
GreyHead 11 Jul, 2009
Hi Pixelfrog,

The two that don't validate both show JavaScript errors in the FireBug console. Both show "sliderInit is not defined" and the ItemID=69 one also shows a FieldProperty Null for the id=INVERTERS_MODULE_COUNT_0 which does not have a name attribute.

Bob
pixelfrog 11 Jul, 2009
Shouldn't the onload sliderInit effect all of the forms? I removed that from my template file and the Select Boxes still don't validate.

I'm so confused as to why the ones work and the others don't.
pixelfrog 11 Jul, 2009
Hi Bob,

Thanks again for your help.

I've narrowed down the trouble to this code:


<div id="ERROR_INVERTERS_DATE_DAY_0" class="clearfix">
<label for="INVERTERS_DATE_DAY_0" class="inputTextLabel">Date of commissioning / purchase*</label>
<br />
<br />
<br>
<div align="left" style="margin: -18px 0px 0px 20px;" ><input type="text" size="10" id="INVERTERS_DATE_DAY_0" name="INVERTERS_DATE_DAY[0]" class="inputText required validate-digits " maxlength="2" value="dd" onfocus="if (this.value == 'dd') this.value='';" onblur="if (this.value == '') this.value='dd';">.

<input type="text" id="INVERTERS_DATE_MONTH_0" name="INVERTERS_DATE_MONTH[0]" size="10" class="inputText required validate-digits " maxlength="2" value="mm" onfocus="if (this.value == 'mm') this.value='';" onblur="if (this.value == '') this.value='mm';">.

<input type="text" id="INVERTERS_DATE_YEAR_0" name="INVERTERS_DATE_YEAR[0]" size="10" class="inputText required validate-digits " maxlength="4" value="yyyy" onfocus="if (this.value == 'yyyy') this.value='';" onblur="if (this.value == '') this.value='yyyy';"></div>
</div>
<br>
<div id="ERROR_INVERTERS_MODULE_COUNT_0" class="clearfix">
<label for="INVERTERS_MODULE_COUNT_0" class="inputTextLabel">Number of modules per inverter </label><br /><br />
<br>
<div align="left" style="margin: -18px 0px 0px 20px;" ><input type="text" id="INVERTERS_STRING_COUNT_0" size="15" name="INVERTERS_STRING_COUNT[0]" class="inputText ">
<input type="text" id="INVERTERS_MODULE_COUNT_0" size="15 class="inputText "> <small>Strings / Modules</small></div><br />




Like you pointed out before it's the "name="INVERTERS_DATE_DAY[0]" that's screwing it up. What are the square brackets doing? That's what's returning the null event correct?

Is there any work around? Not sure why the original coder did it that way, that depth of coding is way over my head.

Thanks again Bob!


Paul
GreyHead 12 Jul, 2009
Hi pixelfrog,

I'm still seeing the SliderInit error on two of the pages although they all seem to have <body onload="sliderInit();">on them.

Some of the pages are loading both MooTools 1.1. (from the Joomla system) and MooTools 1.2 (from the template), this can also cause problems.

I'm not seeing the LiveValidation error at the moment but this could just be masked by the other JavaScript errors.

Please check that all of your input fields have name attributes e.g.
<input type="text" id="INVERTERS_MODULE_COUNT_0" size="15 class="inputText ">
from the snippet you posted. LiveValidation tries to attach some methods to all of the inputs in the form and throws an error is any of them don't have name attributes (even submit and reset inputs where the name isn't techncally required).

The square brackets ae used to designate an array value so you might use inverters['count'], inverters['day'], inverters['month'], inverters['year'] to group together a set of related input values. In the results this would appear as $inverters = array('count' => '3', 'day' => '12', 'month' => '07, 'year' => '2009')

Bob
pixelfrog 12 Jul, 2009
WOOO HOOO! That fixed it Bob, thank you so much for the help! My stupid submit button didn't have a name, and that was screwing the whole thing up, but only when a certain <div> tag was missing from the code, weird.

Not sure how to fix the slider definition problem, I've defined it a few times and the error still comes up.

Thanks again!

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