Is evolutionValidation only used to validate data in input fields, or can it also be used for client-side validation on select boxes and textareas? What can I use to validate select box and textarea input?
Is evolutionValidation only used to validate data in input fields, or can it also be used for client-side validation on select boxes and textareas? What can I use to validate select box and textarea input?
I have used evolution validation for Select boxes what is the issue you're seeing?
The following code is not triggering the validation message for my country select box:
saveButton.evolutionValidation('addField',
context.country,
{
required: true,
},
$(".country").closest('.field-item').find('.field-item-validation'));
Do does your select have a class of country or an Id? Can we see the HTML markup as well?
Here you go:
<li class="field-item">
#set($countryUserProfileField = $core_v2_userProfileField.Get("Country"))
#set($field = false)
#set($field = $user.ProfileFields.Get('Country'))
<label class="field-item-name" for="$core_v2_widget.UniqueId($countryUserProfileField.Name)">$countryUserProfileField.Title:</label>
<span class="field-item-input">
#foreach ($country in $countries)
#beforeall
<select id="$core_v2_widget.UniqueId($countryUserProfileField.Name)" name="$core_v2_widget.UniqueId($countryUserProfileField.Name)" class="ui-select country">
<option value="">Select</option>
#each
<option value="$country.iso2"#if ($field && $field.Value != '' && $field.Value == $country.iso2) selected #end>$country.country</option>
#afterall
</select>
#end
</span>
<span class="field-item-validation" style="display: none;"></span>
</li>Here you go:
<li class="field-item">
#set($countryUserProfileField = $core_v2_userProfileField.Get("Country"))
#set($field = false)
#set($field = $user.ProfileFields.Get('Country'))
<label class="field-item-name" for="$core_v2_widget.UniqueId($countryUserProfileField.Name)">$countryUserProfileField.Title:</label>
<span class="field-item-input">
#foreach ($country in $countries)
#beforeall
<select id="$core_v2_widget.UniqueId($countryUserProfileField.Name)" name="$core_v2_widget.UniqueId($countryUserProfileField.Name)" class="ui-select country">
<option value="">Select</option>
#each
<option value="$country.iso2"#if ($field && $field.Value != '' && $field.Value == $country.iso2) selected #end>$country.country</option>
#afterall
</select>
#end
</span>
<span class="field-item-validation" style="display: none;"></span>
</li>What are you passing to the javascript in the context.country
jQuery(function()
{
jQuery.telligent.evolution.widgets.editUser.register({
userId: $user.Id,
email: '$user.PrivateEmail',
wrapperId : '$core_v2_widget.WrapperElementId',
saveSuccessText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('EditProfile_UpdateSuccess'))',
saveErrorText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('EditProfile_SaveError'))',
formIncompleteText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('FormIncompleteText'))',
plansUrl : '$core_v2_encoding.JavascriptEncode($core_v2_widget.GetStringValue('plansUrl', 'http://localhost:3000'))',
accountType : '#$core_v2_widget.UniqueId('AccountType')',
birthDay : '#$core_v2_widget.UniqueId('day')',
birthMonth : '#$core_v2_widget.UniqueId('month')',
birthYear : '#$core_v2_widget.UniqueId('year')',
gender : '#$core_v2_widget.UniqueId('Gender')',
country : '#$core_v2_widget.UniqueId('Country')',
region : '#$core_v2_widget.UniqueId('Region')',
city : '#$core_v2_widget.UniqueId('City')',
displayname : '#$core_v2_widget.UniqueId('DisplayName')',
bio : '#$core_v2_widget.UniqueId('UserBio')',
workInterests : '#$core_v2_widget.UniqueId('WorkInterests')',
experience : '#$core_v2_widget.UniqueId('Experience')',
compensation : '#$core_v2_widget.UniqueId('Compensation')'
});
});... and the name of the profile field is 'Country'.