I was wondering why these custom validations aren't showing their error messages on pressing of the submit button:
The JavaScript/JQuery:
context.validateFile1 = saveButton.evolutionValidation('addCustomValidation', 'mediafileuploaded1', function () { return ((context.file1 && !context.uploading && ((!context.file1.isRemote && context.file1.fileName && context.file1.fileName.length > 0) || (context.file1.isRemote && context.file1.url && context.file1.url.length > 0))) || !context.registration || _getAccountType(context) == 'Other'); }, context.requiredFieldText, '#' + context.wrapperId + ' .field-item1.post-attachment .field-item-validation', null ); context.validateFile2 = saveButton.evolutionValidation('addCustomValidation', 'mediafileuploaded2', function () { return ((context.file2 && !context.uploading && ((!context.file2.isRemote && context.file2.fileName && context.file2.fileName.length > 0) || (context.file2.isRemote && context.file1.url && context.file2.url.length > 0))) || !context.registration || _getAccountType(context) == 'Other'); }, context.requiredFieldText, '#' + context.wrapperId + ' .field-item2.post-attachment .field-item-validation', null ); context.validateFile3 = saveButton.evolutionValidation('addCustomValidation', 'mediafileuploaded3', function () { return ((context.file3 && !context.uploading && ((!context.file3.isRemote && context.file3.fileName && context.file3.fileName.length > 0) || (context.file3.isRemote && context.file3.url && context.file3.url.length > 0))) || !context.registration || _getAccountType(context) == 'Other'); }, context.requiredFieldText, '#' + context.wrapperId + ' .field-item3.post-attachment .field-item-validation', null ); context.validateFile4 = saveButton.evolutionValidation('addCustomValidation', 'mediafileuploaded4', function () { return ((context.file4 && !context.uploading && ((!context.file4.isRemote && context.file4.fileName && context.file4.fileName.length > 0) || (context.file4.isRemote && context.file1.url && context.file4.url.length > 0))) || !context.registration || _getAccountType(context) == 'Other'); }, context.requiredFieldText, '#' + context.wrapperId + ' .field-item4.post-attachment .field-item-validation', null ); context.validateCountry = saveButton.evolutionValidation('addCustomValidation', 'countrySelected', function () { return ($(context.country).val() !== ''); }, context.requiredFieldText, $(".country").closest('.field-item').find('.field-item-validation'), null );
The Velocity/HTML:
#set($countries = false) #set($countries = $Ibby_v1_LocationData.GetAllCountries()) #if ($countries) <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 data-country="$country.country">$country.country</option> #afterall </select> #end </span> <span class="field-item-validation" style="display: none;"></span> </li> <h2 style="text-align:center">$core_v2_language.GetResource('UploadInstructions')</h2> </p> #set($attachment1FileName = false) #set($attachment1Url = false) #set($attachment1IsRemote = false) #set($attachment1IsRemoteContextId = false) #set($attachment1IsNew = false) #set($tempData = false) #if ($core_v2_page.GetQueryStringValue('tsid')) #set($tempDataString = false) #set($tempDataString = $core_v2_utility.GetTemporaryData($core_v2_page.GetQueryStringValue('tsid'))) #if($tempDataString) #set($tempData = $core_v2_page.ParseQueryString($tempDataString)) #set($attachment1FileName = $!tempData.Value('filename')) #set($attachment1Url = $!tempData.Value('fileurl')) #set($attachment1IsNew = true) #if ($tempData.Value('fileurl')) #set($attachment1IsRemote = true) #else #set($attachment1IsRemote = false) #end #set($attachment1ContextId = $!tempData.Value('filecontextid')) #end #end #if (!$attachment1ContextId) #set($attachment1ContextId = $core_v2_uploadedFile.CreateContextId()) #end <p id="$core_v2_widget.UniqueId('attachment1')" class="field-item1 required post-attachment upload-with-preview"> <label for="$core_v2_widget.UniqueId('attachment1_input')" class="field-item-name">$core_v2_language.GetResource('Attachment_File1')</label> <span class="field-item-input file"> <input type="text" columns="90" id="$core_v2_widget.UniqueId('attachment1_input')" #if($attachment1Url && $attachment1IsRemote)value="$core_v2_encoding.HtmlAttributeEncode($attachment1Url)"#elseif($attachment1FileName)value="$core_v2_encoding.HtmlAttributeEncode($attachment1FileName)"#end #if ($media) disabled="true" #end /> </span> <span class="field-item-input preview"> </span> <span class="field-item-input upload"> <a href="#" class="upload add" id="$core_v2_widget.UniqueId('upload1')">$core_v2_language.GetResource('UploadFile')</a> <a href="#" class="remove" style="margin-left: 1em;">$core_v2_language.GetResource('RemoveFile')</a> </span> <span class="field-item-validation" style="display: none;"></span> </p> #set($attachment2FileName = false) #set($attachment2Url = false) #set($attachment2IsRemote = false) #set($attachment2IsRemoteContextId = false) #set($attachment2IsNew = false) #set($tempData = false) #if ($core_v2_page.GetQueryStringValue('tsid')) #set($tempDataString = false) #set($tempDataString = $core_v2_utility.GetTemporaryData($core_v2_page.GetQueryStringValue('tsid'))) #if($tempDataString) #set($tempData = $core_v2_page.ParseQueryString($tempDataString)) #set($attachment2FileName = $!tempData.Value('filename')) #set($attachment2Url = $!tempData.Value('fileurl')) #set($attachment2IsNew = true) #if ($tempData.Value('fileurl')) #set($attachment2IsRemote = true) #else #set($attachment2IsRemote = false) #end #set($attachment2ContextId = $!tempData.Value('filecontextid')) #end #end #if (!$attachment2ContextId) #set($attachment2ContextId = $core_v2_uploadedFile.CreateContextId()) #end <p id="$core_v2_widget.UniqueId('attachment2')" class="field-item2 required post-attachment upload-with-preview" > <label for="$core_v2_widget.UniqueId('attachment2_input')" class="field-item-name">$core_v2_language.GetResource('Attachment_File2')</label> <span class="field-item-input file"> <input type="text" columns="90" id="$core_v2_widget.UniqueId('attachment2_input')" #if($attachment2Url && $attachment2IsRemote)value="$core_v2_encoding.HtmlAttributeEncode($attachment2Url)"#elseif($attachment2FileName)value="$core_v2_encoding.HtmlAttributeEncode($attachment2FileName)"#end #if ($media) disabled="true" #end /> </span> <span class="field-item-input preview"> </span> <span class="field-item-input upload"> <a href="#" class="upload add" id="$core_v2_widget.UniqueId('upload2')">$core_v2_language.GetResource('UploadFile')</a> <a href="#" class="remove" style="margin-left: 1em;">$core_v2_language.GetResource('RemoveFile')</a> </span> <span class="field-item-validation" style="display: none;"></span> </p> #set($attachment3FileName = false) #set($attachment3Url = false) #set($attachment3IsRemote = false) #set($attachment3IsRemoteContextId = false) #set($attachment3IsNew = false) #set($tempData = false) #if ($core_v2_page.GetQueryStringValue('tsid')) #set($tempDataString = false) #set($tempDataString = $core_v2_utility.GetTemporaryData($core_v2_page.GetQueryStringValue('tsid'))) #if($tempDataString) #set($tempData = $core_v2_page.ParseQueryString($tempDataString)) #set($attachment3FileName = $!tempData.Value('filename')) #set($attachment3Url = $!tempData.Value('fileurl')) #set($attachment3IsNew = true) #if ($tempData.Value('fileurl')) #set($attachment3IsRemote = true) #else #set($attachment3IsRemote = false) #end #set($attachment3ContextId = $!tempData.Value('filecontextid')) #end #end #if (!$attachment3ContextId) #set($attachment3ContextId = $core_v2_uploadedFile.CreateContextId()) #end <p id="$core_v2_widget.UniqueId('attachment3')" class="field-item3 required post-attachment upload-with-preview" > <label for="$core_v2_widget.UniqueId('attachment3_input')" class="field-item-name">$core_v2_language.GetResource('Attachment_File3')</label> <span class="field-item-input file"> <input type="text" columns="90" id="$core_v2_widget.UniqueId('attachment3_input')" #if($attachment3Url && $attachment3IsRemote)value="$core_v2_encoding.HtmlAttributeEncode($attachment3Url)"#elseif($attachment3FileName)value="$core_v2_encoding.HtmlAttributeEncode($attachment3FileName)"#end #if ($media) disabled="true" #end /> </span> <span class="field-item-input preview"> </span> <span class="field-item-input upload"> <a href="#" class="upload add" id="$core_v2_widget.UniqueId('upload3')">$core_v2_language.GetResource('UploadFile')</a> <a href="#" class="remove" style="margin-left: 1em;">$core_v2_language.GetResource('RemoveFile')</a> </span> <span class="field-item-validation" style="display: none;"></span> </p> #set($attachment4FileName = false) #set($attachment4Url = false) #set($attachment4IsRemote = false) #set($attachment4IsRemoteContextId = false) #set($attachment4IsNew = false) #set($tempData = false) #if ($core_v2_page.GetQueryStringValue('tsid')) #set($tempDataString = false) #set($tempDataString = $core_v2_utility.GetTemporaryData($core_v2_page.GetQueryStringValue('tsid'))) #if($tempDataString) #set($tempData = $core_v2_page.ParseQueryString($tempDataString)) #set($attachment4FileName = $!tempData.Value('filename')) #set($attachment4Url = $!tempData.Value('fileurl')) #set($attachment4IsNew = true) #if ($tempData.Value('fileurl')) #set($attachment4IsRemote = true) #else #set($attachment4IsRemote = false) #end #set($attachment4ContextId = $!tempData.Value('filecontextid')) #end #end #if (!$attachment4ContextId) #set($attachment4ContextId = $core_v2_uploadedFile.CreateContextId()) #end <p id="$core_v2_widget.UniqueId('attachment4')" class="field-item4 required post-attachment upload-with-preview" > <label for="$core_v2_widget.UniqueId('attachment4_input')" class="field-item-name">$core_v2_language.GetResource('Attachment_File4')</label> <span class="field-item-input file"> <input type="text" columns="90" id="$core_v2_widget.UniqueId('attachment4_input')" #if($attachment4Url && $attachment4IsRemote)value="$core_v2_encoding.HtmlAttributeEncode($attachment4Url)"#elseif($attachment4FileName)value="$core_v2_encoding.HtmlAttributeEncode($attachment4FileName)"#end #if ($media) disabled="true" #end /> </span> <span class="field-item-input preview"> </span> <span class="field-item-input upload"> <a href="#" class="upload add" id="$core_v2_widget.UniqueId('upload4')">$core_v2_language.GetResource('UploadFile')</a> <a href="#" class="remove" style="margin-left: 1em;">$core_v2_language.GetResource('RemoveFile')</a> </span> <span class="field-item-validation" id="photo4" style="display: none;"></span> </p>
More JavaScript/JQuery:
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'))', exitUrl : #if($core_v2_page.Url.ToLower.Contains('registration_step_3')) '$core_v2_encoding.JavascriptEncode($core_v2_widget.GetStringValue('exitUrl', 'http://localhost:3000'))'#else '$core_v2_encoding.JavascriptEncode($core_v2_urls.User($user.Id))' #end, registration : #if($core_v2_page.Url.ToLower.Contains('registration_step_3')) true #else false #end, 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')', photoUploadedText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('PhotoUploaded'))', file1: { fileName: '#if($attachment1FileName)$core_v2_encoding.JavascriptEncode($attachment1FileName)#end', url: '#if($attachment1Url)$core_v2_encoding.JavascriptEncode($attachment1Url)#end', isRemote:#if($attachment1IsRemote) true#else false#end, isNew:#if($attachment1IsNew) true#else false#end }, attachment1Id: '$core_v2_widget.UniqueId('attachment1')', attachmentProgressText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('UploadProgress'))', attachmentChangeText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('ChangeFile'))', attachmentAddText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('UploadFile'))', attachmentErrorText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('UploadError'))', previewAttachmentUrl: '$core_v2_encoding.JavascriptEncode($core_v2_widget.GetExecutedFileUrl('preview-attachment.vm'))', upload1ContextId: '$core_v2_encoding.JavascriptEncode($attachment1ContextId)', upload1FileUrl : '$core_v2_encoding.JavascriptEncode($core_v2_uploadedFile.GetUploadUrl($attachment1ContextId))', uploadUrl: '$core_v2_encoding.JavascriptEncode($core_v2_widget.GetExecutedFileUrl('uploadedit.vm'))', photoUploadedText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('PhotoUploaded'))', file2: { fileName: '#if($attachment2FileName)$core_v2_encoding.JavascriptEncode($attachment2FileName)#end', url: '#if($attachment2Url)$core_v2_encoding.JavascriptEncode($attachment2Url)#end', isRemote:#if($attachment2IsRemote) true#else false#end, isNew:#if($attachment2IsNew) true#else false#end }, attachment2Id: '$core_v2_widget.UniqueId('attachment2')', upload2ContextId: '$core_v2_encoding.JavascriptEncode($attachment2ContextId)', upload2FileUrl : '$core_v2_encoding.JavascriptEncode($core_v2_uploadedFile.GetUploadUrl($attachment2ContextId))', file3: { fileName: '#if($attachment3FileName)$core_v2_encoding.JavascriptEncode($attachment3FileName)#end', url: '#if($attachment3Url)$core_v2_encoding.JavascriptEncode($attachment3Url)#end', isRemote:#if($attachment3IsRemote) true#else false#end, isNew:#if($attachment3IsNew) true#else false#end }, attachment3Id: '$core_v2_widget.UniqueId('attachment3')', upload3ContextId: '$core_v2_encoding.JavascriptEncode($attachment3ContextId)', upload3FileUrl : '$core_v2_encoding.JavascriptEncode($core_v2_uploadedFile.GetUploadUrl($attachment3ContextId))', file4: { fileName: '#if($attachment4FileName)$core_v2_encoding.JavascriptEncode($attachment4FileName)#end', url: '#if($attachment4Url)$core_v2_encoding.JavascriptEncode($attachment4Url)#end', isRemote:#if($attachment4IsRemote) true#else false#end, isNew:#if($attachment4IsNew) true#else false#end }, attachment4Id: '$core_v2_widget.UniqueId('attachment4')', upload4ContextId: '$core_v2_encoding.JavascriptEncode($attachment4ContextId)', upload4FileUrl : '$core_v2_encoding.JavascriptEncode($core_v2_uploadedFile.GetUploadUrl($attachment4ContextId))' }); }); });