Validation message

Hi,
I am using the captcha in a modal form, it works fine except the fact that the validation of the captcha does not show the error message. Can it depend on the fact that the unobtrusive is active?

<div class="dialogAcquistaPromozione hidden">
                   @{Html.EJ().Dialog("AcquistaPromozioneDialog").Title(PLV.Web.Resources.Promozioni.AcquistaPromozioneTitolo).ShowOnInit(false).IsResponsive(true).Containment("dialog").ContentTemplate(@<div>
               <div id="dvform">
                   @using (Ajax.BeginForm("AcquistaPromozione""Promozione"new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "dvform" }))
                   {
                       @Html.AntiForgeryToken()
                       @Html.HiddenFor(m => m.Acquisto.Offerta)
                       <div class="row">
                           <div class="col-sm-12 col-lg-12 text-center">
                               <p class="top">@PLV.Web.Resources.Promozioni.AcquistaPromozioneTesto<p>
                                   <div class="form-group-lg">
                                       <div class="e-rowcell">
                                           @Html.LabelFor(m => m.Acquisto.Nome)
                                           @Html.EditorFor(m => m.Acquisto.Nome, new { htmlattributes = new { @class = "form-control" } })
                                           @Html.ValidationMessageFor(m => m.Acquisto.Nome, ""new { @class = "text-danger" })
                                       </div>
                                   </div>
                                   <div class="form-group-lg">
                                       <div class="e-rowcell">
                                           @Html.LabelFor(m => m.Acquisto.Cognome)
                                           @Html.EditorFor(m => m.Acquisto.Cognome, new { htmlattributes = new { @class = "form-control" } })
                                           @Html.ValidationMessageFor(m => m.Acquisto.Cognome, ""new { @class = "text-danger" })
                                       </div>
                                   </div>
                                   <div class="form-group-lg">
                                       <div class="e-rowcell">
                                           @Html.LabelFor(m => m.Acquisto.Email)
                                           @Html.TextBoxFor(m => m.Acquisto.Email, new { @class = "form-control input-lg" })
                                           @Html.ValidationMessageFor(m => m.Acquisto.Email, ""new { @class = "text-danger" })
                                       </div>
                                   </div>
                                   <div class="form-group-lg">
                                       <div class="e-rowcell">
                                           @Html.LabelFor(m => m.Acquisto.Telefono)
                                           @Html.EditorFor(m => m.Acquisto.Telefono, new { htmlattributes = new { @class = "form-control" } })
                                           @Html.ValidationMessageFor(m => m.Acquisto.Telefono, ""new { @class = "text-danger" })
                                       </div>
                                   </div>
                                   <div class="form-group-lg">
                                       <div class="e-rowcell">
                                           @Html.CheckBoxFor(m => m.Acquisto.Privacy, new { htmlattributes = new { @class = "form-control" } })
                                           <small>@Html.LabelFor(m => m.Acquisto.Privacy)</small>
                                           @Html.ValidationMessageFor(m => m.Acquisto.Privacy, ""new { @class = "text-danger" })
                                       </div>
                                   </div>
                                   @(Html.EJ().Captcha("captcha").EnableAutoValidation(true).ShowAudioButton(true).ShowRefreshButton(true).Locale(CultureInfo.CurrentCulture.TextInfo.CultureName).RequestMapper(Url.Action("RefreshCaptcha""Promozione")).MinimumLength(6).CustomErrorMessage(PLV.Web.Resources.Promozioni.AcquistaPromozioneErrorCaptcha).TargetButton("btnSubmit"))
                                   <hr />
                                   <button type="submit" id="btnSubmit" class="buttonyellow animated fadeInLeftBig">@PLV.Web.Resources.Common.Invia</button>
                                   <button type="reset" onclick="closeDialog()" class="buttoncolor animated fadeInRightBig">@PLV.Web.Resources.Common.Cancella</button>
                           </div>
                       </div>
                   }
               </div>
           </div>).EnableModal(true).EnableResize(false).Width(500).IsResponsive(true).Render();}
               </div>





1 Reply

KR Keerthana Rajendran Syncfusion Team February 1, 2018 07:20 AM UTC

Hi Pio Luca,   
   
Thank you for using Syncfusion products.   
   
We have checked the captcha validation with unobtrusive mode in MVC and the validation works fine at our end. On looking your code, it seems you have set some culture for captcha using locale property. So please ensure whether the corresponding text for the mentioned culture is added in script section of the sample.   
   
Refer to the below give code   
 
@(Html.EJ().Captcha("captcha").EnableAutoValidation(true).Locale("it-IT").RequestMapper("Refresh").TargetButton("submit"))<br /><br /><br/>    
              @Html.EJ().Button("submit").Size(ButtonSize.Large).Text("Submit").Type(ButtonType.Submit)   
   
   
Add corresponding text for the locale to show custom error message.   
   
<script>   
        ej.Captcha.Locale["it-IT"] = {   
                   placeHolderText: "Digita il codice visualizzato",   
                   customErrorMessage: "CAPTCHA non valido. Riprova"   
               };   
           </script>   
   
We have attached a sample for your reference which can be downloaded from the below link   
   
   
If you still face issue with validation, please modify the above sample to reproduce the issue along with product version used in your project so that it will be helpful for us to validate and provide better solution at the earliest.   
   
Regards,   
Keerthana.  
 


Loader.
Up arrow icon