Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

I am using zoo visitor to register members onto a site. Some member groups are required to select their country which is saved in their entry as a category.

There is also a region field which is a sub category list linked to the country.

I have all the required field errors set inline but am not sure how I would require the country category (and if possible the region if it was present)

Here is the relevant section of my code :

{exp:zoo_visitor:registration_form return='/register/success' allowed_groups="7|8" datepicker="yes" error_handling="inline" rules:country="required"}
<label for="mobile" class="required">Mobile number:</label>
<input type="text" name="mobile" id="mobile" value="{mobile}" />
<span class="error">&nbsp;{error:mobile}</span><br>

<label for="country_of_residence" class="required">Country:</label>
<select name="category[]" id="country" class="quicksearch region_optional"> 
    <option value="">Select Country</option>  
    {exp:channel:categories category_group="1" parent_only="yes" style="linear" parse="inward"}
    <option data-name="{category_name}" value="{category_id}">{category_name}</option>
    {/exp:channel:categories}</select> 
    <br><span class="error">&nbsp;{error:country}</span>

<label for="regions" class="required">Region:</label>       
<select name="category[]" id="regions" class="quicksearch"> 
    <option value="">Select Region</option>
    {exp:channel:categories disable="category_fields" style="linear"}
    {if parent_id == '0'}{if count != '1'}</optgroup>{/if}<optgroup label="{category_name}">{/if}
    {if parent_id != '0'}<option value="{category_id}">{category_name}</option>{/if}
    {/exp:channel:categories}
    </select> <br>

{/exp:zoo_visitor:registration_form}
share|improve this question
    
May I suggest that you tab your code. Will be so much easier to digest. –  Anna_MediaGirl Jan 23 '13 at 4:20

2 Answers 2

As inline error handling works for channel's custom fields and native fields like Title, URL title but not for category.

You should show global error messages for it like

{global_errors}{error}{/global_errors}

Hope it would help you.

share|improve this answer
up vote 0 down vote accepted

Thanks for the suggestestions. I have decided to use jquery validation on the form instead. i think it will give me beter control over the the output.

http://github.com/posabsolute/jQuery-Validation-Engine

Demo: http://www.position-relative.net/creation/formValidator/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.