IBM developerWorks
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old August 27th, 2004, 02:41 PM
gotspy's Avatar
gotspy gotspy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Buffalo, NY
Posts: 156 gotspy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 59 m 53 sec
Reputation Power: 6
Don't clear my page when I go back!!

I have a page that a user inputs data into. They click next and the data is error checked. If a problem is found it posts a message like, "The VARIABLE must be a number." or "The VARIABLE must be X long." Then at the end of list of errors it says, "Please click your browser's back button to correct this."

My issue is when they click back the form is reset and they have to enter everything again. (like if you hit the reset button) I could have sworn that this never happened before...

Is there a limit to the number of form fields it will cache before it gives up? I have move than 50 of them. I am "Form Method=Post"-ing the data to the next page.

Thanks for the help!
__________________
Forget Milk!
Gotspy?

www.gotspy.com

Reply With Quote
  #2  
Old August 27th, 2004, 02:46 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
I don't recommend using the built-in CF server side validation. Do it yourself and then you can handle the errors however you like, maybe redisplay the form with the errored fields highlighted or something...
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old August 27th, 2004, 02:55 PM
gotspy's Avatar
gotspy gotspy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Buffalo, NY
Posts: 156 gotspy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 59 m 53 sec
Reputation Power: 6
Kiteless,
Thanks for the reply! The validation that I am doing, I am writing in all on my own. Here's more on how it works:

Form name=test action=submit.cfm

input type=text name=phone size=10 maxlength=10

input type=text name=name size=30 maxlength=30

/form

On the submit page:

cfif isnumeric(phone) IS "no"
display: Dude, use numbers, DUH!
/cfif

cfif len(name) IS 0
display: is this the artist formerly known as prince or something? Enter a name!
/cfif


That is SUPER simplified, but that is the jist of it. I use it on all of my forms and is very flexible, and allows me to make sure I am getting just the data I want. It also a lot faster to code than to redisplay the page with the errors bold and red. Know what I mean?

So the user gets an error page telling them what they goofed up, and tells them to go back and fix it, but with this one, when they go back, they get a reset form and have to start over...

Reply With Quote
  #4  
Old August 27th, 2004, 03:35 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
I think this is a browser issue or an HTTP header issue. Basically this isn't a CF problem.

One option might be to use session variables, set them to default to blank on your form when the user first fills it out, and then set them on your validation page to the values used in the form. When they go back, you'll be populating the fields with the values from the session variables.

And, while it might be easier for *you*, I'm sure it is *not* easier for your users to have to go back and remember what your validation messages were. What if there were 15 failed messages? Yes it's more work, but that's our job. I'd still recommend that you redisplay the form and highlight the problem fields. Or better yet, avoid a lot of the problem by using some Javascript. You still need to validate on the server side too in case Javascript is turned off, but you'll catch 95% of these before the user even submits the form. Check out the qForms API from Pengoworks.

Reply With Quote
  #5  
Old August 27th, 2004, 03:52 PM
gotspy's Avatar
gotspy gotspy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Buffalo, NY
Posts: 156 gotspy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 59 m 53 sec
Reputation Power: 6
Bah! I'm leaning towards what you are saying, it being an HTTP or browser issue.

I know what you mean about redisplaying the form, if it wasn't a fast and dirty form for our sales force, I would redisplay the form, but they never listen and this will be a pain for them, so all the better for my laughs as I watch them try to cut corners, then have to go back... MuHaHaHa...

Althought filling out the form again is a bit rough...

I'm going to look more into your session var idea. That sounds good.

Thanks!

Reply With Quote
  #6  
Old August 28th, 2004, 01:32 AM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 183 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 16 h 46 m 44 sec
Reputation Power: 0
Thumbs up Sessions buddy, Sessions!

Sessions is the key!

1.
First put this on top of page

Code:
<CFIF (NOT IsDefined("SESSION.Alas"))>
  
  <CFSET SESSION.Alas= StructNew()>
    
  <CFSET SESSION.Alas.FirstName  = "#CFQUERYNAMETHATYOUPUT.FirstName#">
</CFIF>


2.
Then put this

Code:
<CFIF IsDefined("Form.FirstName")>
  <CFSET SESSION.Alas.FirstName = Form.FirstName>
</CFIF>


This will get you started, you should then create a sort of wizard that will go from a form page to a Thank You "PERSONS Name"

Good hunting

-Alas

Reply With Quote
  #7  
Old August 28th, 2004, 01:57 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
Even easier:

At top of form page...
<cfparam name="session.alas" default="#structNew()#" />
<cfparam name="session.alas.firstName" default="" />

In the form...
<input type="text" name="firstName" value="#session.alas.firstName#">

So it would be blank by default, but on the validation page you can then do...

<cfif validationFailed>
<cfset session.alas.firstName = form.firstName>
<cfinclude template="dsp_theform.cfm" /> or maybe a cflocation...

Reply With Quote
  #8  
Old August 28th, 2004, 07:48 PM
kaasu kaasu is offline
Web Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 58 kaasu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 4 sec
Reputation Power: 5
If you are running CFMX, AFAIK you do not have to use the first line. It will create a structure for you if doesn't exists

<cfparam name="session.alas" default="#structNew()#" /> <!--- you do not need this ---->
<cfparam name="session.alas.firstName" default="" />

Reply With Quote
  #9  
Old August 28th, 2004, 11:54 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
True, the first line isn't required. But I think that explicitly declaring it makes your intentions more clear.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Don't clear my page when I go back!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway