|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Checking inside the Post Page
Hey all, quick question.
So, i'm doing a check inside a post page to see if a record exsists similar to the one the user is currently trying to input. What I want to do, is if a similar record is found I want to give the user a choice, to either click button A and continue processing the record, or click button B and abort. Now i'm not quiet sure how to do this, aborting the process is easy enough, but i'm not sure how to set a button inside the post page to basically say "if the user clicks this continue processing" Thanks Caden |
|
#2
|
|||
|
|||
|
I'm thinking that I can base the if off of if the check query is gt 0 and if a variable = 0 or 1
is it possible for me to post back to a page that was just posted retaining the information inside that post? I think i'll try it right now...hmm, don't think that worked, or is going to work... Last edited by Caden : September 12th, 2005 at 02:26 PM. |
|
#3
|
|||
|
|||
|
No, you have to manually maintain the state of the form. The easiest way to do this is to set defaults when you want the form to be blank (ie <cfparam name="firstName" default=""/>) which will default all the form fields to blank (or whatever you want them to be).
So in the form you can do <input type="text" name="firstName" value="#firstName#"> But when you are posting back to the form, now those values will exist and instead of defaulting them to blank they'll have the values that were posted from the form.
__________________
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 |
|
#4
|
|||
|
|||
|
One more quick one...
Can I set application variables from other pages... so, I have a variable set to 0 inside the application.cfm page...can I set it to 1 from a different page? Thanks Caden |
|
#5
|
|||
|
|||
|
nevermind
|
|
#6
|
|||
|
|||
|
You can, but I wouldn't recommend it. Application.cfm/Application.cfc is meant for application-wide configuration and processing. Something specific to a single page in your app should not be manipulated that way.
|
|
#7
|
|||
|
|||
|
hmm, well I think I have to have a global variable somewhere that I can use as a flag, not sure how else to do it without the application file.
|
|
#8
|
|||
|
|||
|
What kind of flag?
|
|
#9
|
|||
|
|||
|
just a variable set to 0 or 1 that isn't on the page where my code is.
|
|
#10
|
|||
|
|||
|
But what is the flag actually for? And remember that Application.cfm runs before EVERY page request...it's generally a red flag when you are adding something to this file that will only be used by one page.
|
|
#11
|
|||
|
|||
|
Ohh this is what happens.
I am inputing files into the database, and inside the post page I am checking against the database to see if a similar file is already there based off of the first 3 letters of the first and last name. So what's happening is inside the post page I do an if statement checking if the SQL query pulled anything and the variable inside the application page is at 0. So, if that if is satisfied it sets the variable to 1 and I give the user a check saying basically "a similar record exsists, would you still like to enter this record" if they click yes then because the variable is 1 it posts back to itself and bypasses that original if statement, posts and sets the variable back to 0. My problem was setting a flag so the app knows if a user has just posted normally or posted wanting to add a checked record into the database. I can't set a variable inside the post page because once it posts back to itself it will be reset, creating my problem. |
|
#12
|
|||
|
|||
|
Couldn't you just pass an additional hidden form field that you can use as the flag?
|
|
#13
|
|||
|
|||
|
...
Yes, yes I suppose I could. I think i'll go do that now. Thanks ![]() |
|
#14
|
|||
|
|||
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Checking inside the Post Page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|