Validate File Upload Component

G

Guest

Hello All

I'm trying to do something I would think would think would be fairly easy.
I am trying to validate the FrontPage File Upload component on a form I have.
Apparently, this is harder than expected. I want to validate that the field
next to the "Browse" button actually has text in it. For some reason though,
this is difficult, probably because it is not a standard text field. Still
though, I would hope there is some way to validate the form so users can't
simply click the submit button and send off nothing. I have a confirmation
page attached to the form that states the upload was a success. However
(since my users are pretty computer illiterate), some are clicking the submit
button without there being any text in the field. They then think everything
went smoothly, but it did not. I have to call these people up and tell them
why their files didn't get through (frustrating).

If anyone has any ideas (possibly some Javascript code that could help), I'd
greatly appreciate hearing them.

Thanks!
 
S

Stefan B Rusynko

Add an onclick event to the submit button and check for an empty field value in the upload form field name
- some methods are at http://irt.org/script/form.htm#5

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


| Hello All
|
| I'm trying to do something I would think would think would be fairly easy.
| I am trying to validate the FrontPage File Upload component on a form I have.
| Apparently, this is harder than expected. I want to validate that the field
| next to the "Browse" button actually has text in it. For some reason though,
| this is difficult, probably because it is not a standard text field. Still
| though, I would hope there is some way to validate the form so users can't
| simply click the submit button and send off nothing. I have a confirmation
| page attached to the form that states the upload was a success. However
| (since my users are pretty computer illiterate), some are clicking the submit
| button without there being any text in the field. They then think everything
| went smoothly, but it did not. I have to call these people up and tell them
| why their files didn't get through (frustrating).
|
| If anyone has any ideas (possibly some Javascript code that could help), I'd
| greatly appreciate hearing them.
|
| Thanks!
 
G

Guest

Okay, that was surprisingly simple and a HUGE pain at the same time. Don't
think I didn't try some simple Javascript to do a little validation before
hand. I did, but my JavaScript is SOOOO terrible, I can't tell you how many
dumb errors I had in there before I got it to work. I was thinking that it
was just not a field which could be validated (for whatever reason).

It does seem to be working now (till I start messing with the script again I
would suppose). Here's what I used (very simple code):

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function verify() {
if (document.UploadFrm.txtFileUploadName.value == ""){
alert("Please make sure to input the file path information next to the
'Browse' button. Call if you have questions.")
document.UploadFrm.txtFileUploadName.focus()
return false;
}
if (document.UploadFrm.lstGraderSel.value == "Please Select"){
alert("Please select your name.")
document.UploadFrm.lstGraderSel.focus()
return false;
}
else{
return true;
}
}
// End -->
</script>

The "txtUploadName" is the field I needed to check. The other field in
there is just a simple option field also on the page.

Well, thanks for the help with that. I'm desparately trying to bone up on
my Javascript skills, but I am wary on putting them in the FrontPage site I
have. I know it tends to get finiky with non-FrontPage inherent stuff.

Thanks again!

Stefan B Rusynko said:
Add an onclick event to the submit button and check for an empty field value in the upload form field name
- some methods are at http://irt.org/script/form.htm#5

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


| Hello All
|
| I'm trying to do something I would think would think would be fairly easy.
| I am trying to validate the FrontPage File Upload component on a form I have.
| Apparently, this is harder than expected. I want to validate that the field
| next to the "Browse" button actually has text in it. For some reason though,
| this is difficult, probably because it is not a standard text field. Still
| though, I would hope there is some way to validate the form so users can't
| simply click the submit button and send off nothing. I have a confirmation
| page attached to the form that states the upload was a success. However
| (since my users are pretty computer illiterate), some are clicking the submit
| button without there being any text in the field. They then think everything
| went smoothly, but it did not. I have to call these people up and tell them
| why their files didn't get through (frustrating).
|
| If anyone has any ideas (possibly some Javascript code that could help), I'd
| greatly appreciate hearing them.
|
| Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top