Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #21 (permalink)  
Old June 22nd, 2004, 04:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi qazi_nomi,

So what have you decided to stick with finally? You still want to go for session variables or do it with Javascript?

Let me explain you on that.
With javascript solution...
You can post your form data to confirm.asp and there you can validate and if not okay with the data you can give the control back to registration.asp. using history.back or history.go(-1), but what you would be missing in this way of doing is, you CANNOT let the registration page or the user know that what went wrong with the data and user would go clueless and wondering why you let him comeback to registration page. and you cannot achive what you have asked in your original post. i'd like to see the same form again, but with the wrong field turned red and empty, and the proper filled field should contain their data
Is that what you want to do?

With Session variables...
You can store all the registration data that are posted to confirm.asp in to session variables and use them for validation, if not okay with the data you can still redirect to registration.asp and populate the value on form from the session variables. But there are other factors too. As the other gentlemen suggested here, it would affect the performance of the site when the hit rate is high on the site. And also the session variables are having their own expriy limit of 20 mins by default. Imagine when the user has to attend some other work in the mid of filling the registration form, and comes back to continue the filling the form after 25 mins, by then his session would have been expired and he would really be frustrated to know that he lost all the data and had to fill them again. I am sure, this is not the right approach when you design something that is not user friendly and he would really give up registering to your site. I have never come across anyone choosing this method for validation form data. Also if you are comfortable with going about session variables and do this for all forms in your entire site, I am sure that is going to toss up your web site with slow performance and even crash sometimes.

One can reach an Island by different means.
1) by Flight
2) by Ship
3) by swimming

I prefer going by flight. Some may prefer going by Ship. Do you prefer SWIMMING to reach there? May be you like to have adventure and thrill in that, but beware of Sharks and Whales on your way.
;)

The call is yours.
Hope that explains.
Cheers!

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #22 (permalink)  
Old June 24th, 2004, 01:22 AM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default

Well how abt this,

(1) declare session variables for each form element and initialize them with ""

(2) when putting on the form page use these variables to initialize the form

(3) when you go to the submit page do the validations ... save valid values in corresponding session variables and discard the others with error messages and redirect to form page ..

(4) as in step 2 above the valid values will automatically be loaded into the form ...

try this and let know if it works

Sudhan.
Reply With Quote
  #23 (permalink)  
Old June 24th, 2004, 02:08 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Dear Sudhan the problem in this way is this that we delare session variables . This wil cause a load on our server and speed going to be slowed

Love 4 all
Reply With Quote
  #24 (permalink)  
Old June 24th, 2004, 03:52 AM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default

Well Qazi,

in that guess i think the one page method is best ... well if i think of anything more i will let you know ...

tell about how many such forms do you have and about how many users are gonna use ur application ..

Sudhan

Reply With Quote
  #25 (permalink)  
Old June 24th, 2004, 04:12 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Dear silver_cuts
I have 3 pages like this one . And normally 50 to 100 users use these pages daily

Love 4 all
Reply With Quote
  #26 (permalink)  
Old June 24th, 2004, 04:24 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

This topic is BAD.

I don't think we should spend so much time discussing how to do things incorrectly.

The best practice is the one page method.

If anyone can advise why another method is better than this please contribute.

We should not be recommending or expanding on using sessions to store page data.
As the name suggests session is appropriate for storing data that will be used throughout the session.

This is like having every variable in a windows app as a global variable.

It makes no difference how many pages, or how many users, a best practise should be encouraged.

I'm sorry if I'm a wet blanket, conversation is good, but lets focus on the good information not the bad.

These topics stay on the web for ages and students will search for answers to this very question.

I Hope They Don't Find This One.



======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
Reply With Quote
  #27 (permalink)  
Old June 24th, 2004, 04:40 AM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default

Hi qazi,

i thought of 2 methods for this :

(1) corresponding to each form element add another element which of type HIDDEN carrying value ifthe value is VALID else NULL ... thus u dont need to use session variables and the flow will be almost the same as i suggested earlier ...

(2) this is a new method .. i dont know anything about the performance bcozi have never used it nor thought of it earlier ... is to store the values of a form in a text file and for invalid values make some corresponding valid entries so that you can retrieve them .... by the sound of it .. it seems very bulky and bad performance thing .. bbut i dont think anyone has ever tried it before and hence seems worth a try ..

and QAZI if you have so less users using your applications i dont think u need to worry about performance with session variables ....

plz your comments everybody ...

Sudhan.

Reply With Quote
  #28 (permalink)  
Old June 24th, 2004, 04:51 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I completely agree with Rod on this one. Storing the values in Sessions in this scenario is very bad practice.

The very first solution suggested by Vijay is the best way to go. It's short, it's simple, it won't screw with your server's memory, it's easily expandable, it's easy to understand etc etc.

It *is* a good solution, because it keeps the values to the smallest scope possible. When the page first loads, Request.Form("submit") will be empty, so all variables, like testVal are empty as well.
Then the user fills in a couple of text boxes and hits the submit button. The page is sent to the server where Request.Form("submit") will be true. The values of each HTML form control are assigned to local variables (like testVal in Vijay's scenario) and then tested for validity. If they are valid, the code can proceed and do what it needs to do. If some of them are invalid, a message can be displayed. But more importantly, the variables like testVal still have their value, so they can be used to repopulate the HTML form controls. This way, the user can see a mistake was made, the form retains its values and they can easily fix whatever they need to fix.

Clean, crisp and simple.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Slowly Goes the Night by Nick Cave and the Bad Seeds (Track 7 from the album: Tender Prey) What's This?
Reply With Quote
  #29 (permalink)  
Old June 24th, 2004, 05:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi all there,

I should really thank everyone for your efforts on replying to this topic.

I am tired having read this going long, long and long, so keeping myself out of this topic.;) and focusing to help on other topics too.

But not hearing from qazi_nomi anything about what was decided on this. This should be more than sufficient to convince one to go that way. Are there still any hesitations for not deciding upon this?

All the best.

Cheers!

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #30 (permalink)  
Old June 24th, 2004, 05:13 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Thanks Imar I have done the one poge solution and it is quite nicely working

Love 4 all
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 04:02 AM
Javascript validation not working in content page Manoj Bisht ASP.NET 2.0 Basics 0 March 3rd, 2008 02:21 AM
Validation using Validation Framework kalyangvd Struts 1 January 2nd, 2008 06:53 AM
Form Validation and Redirect Page jourys ASP.NET 1.0 and 1.1 Basics 1 February 24th, 2006 12:20 PM



All times are GMT -4. The time now is 05:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.