Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping file input alive while checking form for errors

Status
Not open for further replies.

Sleidia

Technical User
Joined
May 4, 2001
Messages
1,284
Location
FR
Hello,

I have a simple form validation script that displays the fields with their respective data plus red marks where errors are found so that users don't have to retype their info.

The script will upload the user's file only in case there is no error. The problem is that I can't find a way to keep alive the file input since there is no VALUE parameter available.

Does anyone know how I could allow users to select their file only once even in case of errors?

Thanks a lot for helping ! :)

 
I place the form in a function with the value attribute set to the variable that corresponds to it

(ie <input name=&quot;phone&quot; value=&quot;$phone&quot;>)

When validating, i suck all the data into those variables, check the data for accuracy, format etc, null the fields that are wrong and then call the form function.

For the first run, all the values are null so the form does not display anything.

hth



Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
soory boout that, didin't read it correctly

what about cookieing it with some js?

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
You're outputting the form again. Why not just replace the <input type=&quot;file&quot;...> with a string stating the file is already on the server and a hidden field with the name of the file on the server's filesystem?

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Hello Sleipnir,

Actually, I don't want to have the file uploaded onto the server before it is made sure that the user has applied entirely. If I do like you said, in case the user give up and simply close the page because of the errors founds by the validating sequence, then I have a file I don't need anymore on the server. I could have a maintenance script (ran by cron) that could get rid of the unused files, but I'd prefer to avoid that.

Thanks for your response anyway. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top