1

I have a form containing different required field.

I also have a ValidationSummarywhich will display a pop-up when clicking on the submit button if some required fields are not filled in.

<asp:ValidationSummary runat="server" ID="vsValidationSummary" ValidationGroup="DefaultGroup" DisplayMode="BulletList" ForeColor="Red" ShowMessageBox="true" ShowSummary="false" />

When filling all the fields except one (see below the field) the popup is displayed (OK) but with only the message :

- Required

For other fields there is the name next to "Required"

The field which is failing is the following :

<div class="formFieldLine">
     <span class="userFormLabel">
          <ab:FormLabel Colon="false" runat="server" AssociatedControlID="ddlSuperstructureType" Text="<%$ Resources:lbSuperstructureType.Text %>" />
     </span>
     <ab:LabelledDropDownlist ID="ddlSuperstructureType" runat="server" DataSourceID="dsSuperstructureTypes" DataTextField="Text" DataValueField="Value" CssClass="dropdownSTypeBuyBack" />
     <asp:CustomValidator ID="cvSuperstructureType" runat="server" ControlToValidate="ddlSuperstructureType" ClientValidationFunction="ddlSelected_Validate" ValidationGroup="DefaultGroup"
                    CssClass="validatorMessage" ErrorMessage="<%$ Resources:Messages,RequiredField %>" OnServerValidate="ddlSelected_Validate"/>
     <br />
</div>

Here is a working field

<div class="formFieldLine">
     <span class="userFormLabel">
          <ab:FormLabel Colon="false" runat="server" AssociatedControlID="tbLeasingDuration" Text="<%$ Resources:lblLeasingDuration.Text %>" />
     </span>
     <ab:LabelledTextBox ID="tbLeasingDuration" runat="server" MaxLength="100" />
     <asp:RequiredFieldValidator ID="rvfLeasingDuration" ErrorMessage="<%$ Resources:Messages,RequiredField %>" ControlToValidate="tbLeasingDuration" runat="server" ValidationGroup="DefaultGroup" ForeColor="Red" />
     <br />
     <asp:RangeValidator ID="rvLeasingDuration" Type="Double" ErrorMessage="<%$ Resources:Messages,InvalidNumber %>" ControlToValidate="tbLeasingDuration" ValidationGroup="DefaultGroup" runat="server" MinimumValue="0" MaximumValue="999999999" ForeColor="Red" Display="Dynamic" style="margin-left : 212px;"/>
</div>

Here is a printscreen of the popup : enter image description here

Weedoze
  • 13,683
  • 1
  • 33
  • 63

2 Answers2

0

Instead of passing the mentioned error message,pass the message which you are required to show...

  • The `Error message` in my customValidator ? I cannot modified it, it is displayed next to the dropdown – Weedoze Nov 18 '15 at 13:10
0

Check your render block - this doesn't look right:

<%$ Resources:Messages,RequiredField %>

Should it be this?

<%= Resources:Messages,RequiredField %>
Tim
  • 4,051
  • 10
  • 36
  • 60