PC Review


Reply
Thread Tools Rate Thread

ClientSide Validation (solution to bypass "Refresh" in JavaScript)

 
 
IkBenHet
Guest
Posts: n/a
 
      10th Aug 2005
Hello,

Currently I am using a large input form on a website that is based on
ASP and JavaScript.

Depending on the values that are filled in by the user the forms does a
refresh and makes other input fields available to fill in. I use the
JavaScript OnChange function (=clientside) that creates a querystring
and does a refresh of the page. It works fine.

Some of the users are complaining that on slow connections this refresh
can take very long and other users find this refresh in general not a
friendly solution. And... I agree with them.

Now I am trying to migrate this website to ASP.NET and was looking for
a solution to do what I want to do: Make form fields available/visable
in the same form based on the values filled in in other fields of the
same form without the refresh.

This is want I have found:
http://www.dotnetjunkies.com/quickst...validator2.src

But is this the way to do it? Can it also be ServerSide? I am sure that
I am not the only person in the world trying to do this. Thanks for
your advice. Please note that I am a beginner in ASP.NET.

I can not post the form because it an secured extranet page.

Thanks!

 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      10th Aug 2005
When working with an ASP.NET web form, expect that when you submit, it will
post back to the same page. Your page will be structured with some code to
handle various "events". The two most common are:
- Page_Load. This method is used to setup general values on the page. It is
called every time the page is generated. For example, if you fill in a
DropDownList from a database, do it here when the page is first loaded (the
property Page.IsPostBack is false).
- "Post back event handlers" - These are methods you link to buttons and
other controls that submit the page. They fire only on post back after
Page_Load. You put your code that processes the post back. For example, in
the Button, set the Click event to your method. Then use your Click method
to save the page.
Inside the post back event handlers is where Validation goes. First, you add
the various web controls called "Validators" supplied with ASP.NET to the
web form. Attach them to the fields they evaluate. By design, they will
first attempt to validate on the client-side. But not all browsers are
supported or javascript can be disabled. So eventually the page is posted
back and you should assume the page is still not validated. So you test
Page.IsValid is true in that Click post back event method before saving. If
you find it to be false, just exit the Click event method and the same page
will be redraw, but this time, each validator with an error will be
displayed.

I encourage you to read this article: www.aspalliance.com/699 as you learn
about ASP.NET validators.
You should also consider a better validation system since Microsoft's is
very limited and causes you to write much custom code and develop hacks. I
make one called Professional Validation And More
(http://www.peterblum.com/vam/home.aspx).

--- Peter Blum
www.PeterBlum.com
Email: (E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"IkBenHet" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> Currently I am using a large input form on a website that is based on
> ASP and JavaScript.
>
> Depending on the values that are filled in by the user the forms does a
> refresh and makes other input fields available to fill in. I use the
> JavaScript OnChange function (=clientside) that creates a querystring
> and does a refresh of the page. It works fine.
>
> Some of the users are complaining that on slow connections this refresh
> can take very long and other users find this refresh in general not a
> friendly solution. And... I agree with them.
>
> Now I am trying to migrate this website to ASP.NET and was looking for
> a solution to do what I want to do: Make form fields available/visable
> in the same form based on the values filled in in other fields of the
> same form without the refresh.
>
> This is want I have found:
> http://www.dotnetjunkies.com/quickst...validator2.src
>
> But is this the way to do it? Can it also be ServerSide? I am sure that
> I am not the only person in the world trying to do this. Thanks for
> your advice. Please note that I am a beginner in ASP.NET.
>
> I can not post the form because it an secured extranet page.
>
> Thanks!
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I bypass the requirement to respond "yes" to "item.sent" =?Utf-8?B?Qm9ic2ll?= Microsoft Outlook Discussion 1 22nd Jan 2006 11:32 PM
script language = "js", "jscript", "javascript", "vj#" What to use =?Utf-8?B?UkZTNjY2?= Microsoft ASP .NET 7 28th Oct 2005 12:52 PM
document.execCommand("Refresh"); in JavaScript David Microsoft ASP .NET 1 3rd Jan 2005 10:03 PM
<FORM METHOD="post" onSubmit="return fieldcheck()" name="orientation" action="http://ws-kitty.BU.edu/AT/survey/orientation/script/write.asp" language="JavaScript"> Joeyej Microsoft ASP .NET 0 4th Jun 2004 08:55 PM
Validation rule for entering "A" or "B" or "C" in Access 2002 Joanne Microsoft Access Forms 4 21st Dec 2003 05:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:54 PM.