serverside RequiredValidator not working FireFox

T

TJS

I am finding that the serverside requiredvalidator doesn't fire in the
firefox browser, and user request proceeds through to my updateProfile
method. Validation is working correctly in the IE browser.

Anyone seen this problem or have any ideas why this might be occurring ??

(I have web.config browsercaps updated from http://slingfive.com/ )

code:
=========
Sub Submit_Click(Sender As Object, e As EventArgs)
If Page.IsValid then Call updateProfile()
End Sub


html:
=========

<asp:Button id="Btn_Submit" onClick="Submit_Click" Runat="Server"
Text="Update"></asp:Button>
 
T

TJS

Additional info:
===============

In my page, the form is being pre-filled from a database so the user can
review the existing values in their profile.

when using the firefox browser, I have discovered that when the form has
been given a value such as

"phone.text = [value retrieved from db]"

that the retrieved value is what becomes tested by the validator .

My problem is , if the user changes a value, the validator is not testing
the new entry, but is testing what was originally retrieved from the
database.

Has anyone else seen this problem using firefox ?? is there away to
resolve it ??

(The same page works fine in IE, and the new entries are tested)
 
P

Peter Blum

From your description, I would focus on two things:
1. The code that sets the Text property from the database is running before
you validate. (Makes sense, right?)
The TextBox gets its Text property by looking at
Request.Forms[TextBox.UniqueID] after it gets added to the Page's controls
tree. This is automatic and no feature built into .net will overwrite it.
Only the user's code is allowed to modify the Text property after its added
to the page.
Generally its wise to get the Text property in the post back event handlers
(after Page_Load) because that's when you know its setup. (Post back event
handlers were intended to handle the data sent by the browser with the
assurance the controls have been properly prepared.)
2. What if the TextBox.UniqueID has changed? It will not retrieve the value
passed back from the server. In this case, the ViewState which stored the
original value (from the database) will be in the Text property. The
ViewState is always assigned prior to applying the value from Request.Forms.
How does the UniqueID get changed? Its built upon the ID of the TextBox and
IDs of all naming containers that are its ancestors. For example, if your
textbox is in UserControl "MyUC", UniqueID is "MyUC_:TextBox1". So if any of
the IDs involved are differently, it will cause this problem.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

TJS said:
Additional info:
===============

In my page, the form is being pre-filled from a database so the user can
review the existing values in their profile.

when using the firefox browser, I have discovered that when the form has
been given a value such as

"phone.text = [value retrieved from db]"

that the retrieved value is what becomes tested by the validator .

My problem is , if the user changes a value, the validator is not testing
the new entry, but is testing what was originally retrieved from the
database.

Has anyone else seen this problem using firefox ?? is there away to
resolve it ??

(The same page works fine in IE, and the new entries are tested)




TJS said:
I am finding that the serverside requiredvalidator doesn't fire in the
firefox browser, and user request proceeds through to my updateProfile
method. Validation is working correctly in the IE browser.

Anyone seen this problem or have any ideas why this might be occurring ??

(I have web.config browsercaps updated from http://slingfive.com/ )

code:
=========
Sub Submit_Click(Sender As Object, e As EventArgs)
If Page.IsValid then Call updateProfile()
End Sub


html:
=========

<asp:Button id="Btn_Submit" onClick="Submit_Click" Runat="Server"
Text="Update"></asp:Button>
 
T

TJS

thanks for replying

I'm not after the textbox value stored in the viewstate, or anywhere else,
I'm trying to validate the user entry in the form. The validation should be
looking at the current form value not at the hidden fields.

I don't believe the id issue is the source of the trouble. The validation
works in IE, but not in firefox, so the problem appears to be .net with
firefox browser and prefilled forms.



Peter Blum said:
From your description, I would focus on two things:
1. The code that sets the Text property from the database is running
before you validate. (Makes sense, right?)
The TextBox gets its Text property by looking at
Request.Forms[TextBox.UniqueID] after it gets added to the Page's controls
tree. This is automatic and no feature built into .net will overwrite it.
Only the user's code is allowed to modify the Text property after its
added to the page.
Generally its wise to get the Text property in the post back event
handlers (after Page_Load) because that's when you know its setup. (Post
back event handlers were intended to handle the data sent by the browser
with the assurance the controls have been properly prepared.)
2. What if the TextBox.UniqueID has changed? It will not retrieve the
value passed back from the server. In this case, the ViewState which
stored the original value (from the database) will be in the Text
property. The ViewState is always assigned prior to applying the value
from Request.Forms.
How does the UniqueID get changed? Its built upon the ID of the TextBox
and IDs of all naming containers that are its ancestors. For example, if
your textbox is in UserControl "MyUC", UniqueID is "MyUC_:TextBox1". So if
any of the IDs involved are differently, it will cause this problem.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

TJS said:
Additional info:
===============

In my page, the form is being pre-filled from a database so the user can
review the existing values in their profile.

when using the firefox browser, I have discovered that when the form has
been given a value such as

"phone.text = [value retrieved from db]"

that the retrieved value is what becomes tested by the validator .

My problem is , if the user changes a value, the validator is not
testing the new entry, but is testing what was originally retrieved from
the database.

Has anyone else seen this problem using firefox ?? is there away to
resolve it ??

(The same page works fine in IE, and the new entries are tested)




TJS said:
I am finding that the serverside requiredvalidator doesn't fire in the
firefox browser, and user request proceeds through to my updateProfile
method. Validation is working correctly in the IE browser.

Anyone seen this problem or have any ideas why this might be occurring
??

(I have web.config browsercaps updated from http://slingfive.com/ )

code:
=========
Sub Submit_Click(Sender As Object, e As EventArgs)
If Page.IsValid then Call updateProfile()
End Sub


html:
=========

<asp:Button id="Btn_Submit" onClick="Submit_Click" Runat="Server"
Text="Update"></asp:Button>
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top