• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Storing dynamically added HTML for further validation

#1
[eluser]Bramme[/eluser]
Hey everybody

I'm messing around with a little gallery application. Here's how it works (or should work -_-): people first select files from their computer and hit an upload button (using uploadify, for multiple files), when a file finishes uploading, a form is shown below the upload button.

This form contains an input where people can enter a title for the gallery. The other fields in the form are titles and descriptions for the uploaded images that get added with jquery when a file is finished uploading.

The gallery title is required, but image title and description are not. I have set up some basic validation for this title field, but the problem is, when the form is sent but errors on the validation (when the title field is left empty), the image fields are gone.

Is there any way to store the uploaded images (or the entire html) in something session like? This way, I could still show them, instead of forcing people to upload everything again (not really user friendly :p)

I hope I'm making sense!

#2
[eluser]TheFuzzy0ne[/eluser]
I don't know how uploadify works, but I am quite sure that there's no way to set the file input with a value, nor is there any way to help yourself to a file on someone's PC, even if they've told you where it is. I think this is because it's a security hazard.

If you're doing some client side validation with jQuery, then everything should work OK. If the server validation fails, even though the jQuery validation passed, then it's either a fault with your code, or the user is doing something naughty, in which case it's their own fault. The only other way I can think of doing this, would be to upload all the images first, and then allow users to tag them.

Hope this helps.

#3
[eluser]xwero[/eluser]
I would do a soft validation, a hard validation being showing errors. If the title isn't added the program adds a bogus title, it can be funny or reminding or whatever you feel a user would react on. And the user will get the message the gallery will be offline until the title has changed.

I see hard validation as punishing the user, like a schoolteacher who slapped you when you did something wrong and in the case you are describing this is even noticeable because the user has to re-up the files. But even with dates or input that is too long for example. Help the user if it's possible and then you can show warning messages instead of error messages.

#4
[eluser]Bramme[/eluser]
Hmmm, I like your idea xwero. Thanks for the input!

Thinking out of the box hmm... Very cunning!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.