Solved

Input Validation help needed

Posted on 2007-04-04
5
213 Views
Last Modified: 2013-12-16
Hi, experts,

I need you help on implementing a data validation.
Users enter a value on a form (Order.cfm) for number of files uploaded.
On the same cfm page, there is this <Ifram>(FileList.cfm), which let users browse through their drive/folders, and upload file(s) to our server, one at a time. (FileList.cfm has form Action =FileGet.cfm. And FileGet.cfm does all the uploads)

Then, the submit button on order.cfm will process the rest of the submission of data.

The validation supposed to be between how many files they said they are going to upload and how many files they actually uploaded.

If there is a discrepancy, they will have to either change the value on the field, or add/remove file from the list within the Iframe.

My order.cfm form cfinput name=”NumofFile” Value=#Order.NumofFiles#”
I believe that value is only available after the submit button is clicked. I have not found a way to retain/retrieve the actual number of files uploaded within the Iframe.

Any suggestion is appreciated!


0
Comment
Question by:ommer
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:richswyatt
Comment Utility
In the file upload routine - save into a variable each time a file is uploaded for that instance and add 1 each time.

Then either write that to a data table associating it with that user. Then, at the place you need to check whether what they said they uploaded and what they actually uploaded, call the data from the table and check it against what they're saying.
0
 

Author Comment

by:ommer
Comment Utility
Yah, I have been thinking that approach, but I am also wondering maybe by doing something on the client side, I could save couple trips to my db server. Then I had hard time to make the 2nd cfm in the IFrame to return a value to the 1st cfm.

0
 
LVL 5

Expert Comment

by:richswyatt
Comment Utility
You could send via JavaScript from the IFRAME to the "Parent" frame.

window.myVar=window.MYIFRAME.myVarInTheIframeHere
0
 

Author Comment

by:ommer
Comment Utility
Ok, great!

Now I have last piece of this pazzle that I don't know where it should fit. In which part of the cfm page should I popup this validation message?

I have to admit that I am new to cfm.

I know I could make a call to get the data at the begining of the page in a <cfquery >. I also see a lot of field level validation within the <td><cfinput...validate="float" required="Yes" class="text">
My form has this action property:
The <cfform action="OrderProc.cfm" name="Order" Method="Post">

I think I could do the db call or IFrame var retrieval BEFORE the submit fire up the next cfm. But I have no idea if I should put them before /<cfform>, before </div>, or before </cfoutput>

This is harder than I thought due to my lack of experience. I have doubled the point value. Thanks!

 
0
 
LVL 5

Accepted Solution

by:
richswyatt earned 500 total points
Comment Utility
Ok - this is what I'd do:

In the IFRAME (this is where they are uploading, right?) make sure you are populating the javascript variable for each upload...

Now - when they go to do whatever they are doing in the main page - (whether it is a form submit or whatever) call a javascript function that checks whether the variable populated for the uploads matches what they are indicating in the main page. This would be called from the main page.
If so - then let the form submit - if not - then throw an error.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now