Firefox Validation Issue - not the standard document.[all] problem!

A

andersoj

I have a page that has some required field validators created in the
aspx, and other validators created in the Page_Load event.

In IE, all validation works as expected. In Firefox, ASPX validators
work fine, but the validators created in the code-behind do not.

Am I adding the validators to the wrong control on the page? Right now
I'm finding the main form control and adding them to that. Adding to
Page.Validators didn't work.

ASPX validators:

<asp:ValidationSummary ID="vlSummary" Runat="server" ShowSummary="True"
DisplayMode="BulletList" HeaderText="Please correct the following
error(s):" />

<asp:RequiredFieldValidator ID="vrqFirstName" Runat="server"
ControlToValidate="txtFirstName" ErrorMessage="First Name is required"
Display="None" />

<asp:RequiredFieldValidator ID="vrqLastName" Runat="server"
ControlToValidate="txtLastName" ErrorMessage="Last Name is required"
Display="None" />

<asp:RequiredFieldValidator ID="vrqAddress" Runat="server"
ControlToValidate="txtAddress" ErrorMessage="Address is required"
Display="None" />


Code-behind (called from Page_Load method):
private void AddReqFieldValidator(string fld, string msg_fld)
{
System.Web.UI.WebControls.RequiredFieldValidator rfv = new
System.Web.UI.WebControls.RequiredFieldValidator();
rfv.ID = "vrq" + fld;
rfv.ControlToValidate = fld;
rfv.ErrorMessage = msg_fld + " is required";
rfv.Display = ValidatorDisplay.None;
rfv.EnableClientScript = true;
Page.FindControl("frmPage").Controls.Add(rfv);
}
 
B

Bruce Barker

client script validation is only supported for IE, for other browser, only
serverside validation works. for serverside validation to work, you must
call the IsValid property or the Validate() method in the codebehind.

-- bruce (sqlwork.com)


this requires your copdebehind
 
A

andersoj

Then why do some of the client-side validators work in Firefox? I'd
buy that if none of them worked in Firefox at all.
 
T

TJS

I have found asp: validators to be unreliable with Firefox, in general,
regardless of codebehind.
That's even with browser detection and isvalid checks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top