Tuesday, May 22, 2012

Javascript form won't submit

I have been using the uploader as provided by http://www.hoppinger.com/blog/2010/05/28/file-upload-progress-bar-with-phpapc-and-javascript/ and have since applied it to one of my forms and whilst the progress meter works, the submit function doesn't fire on successful upload.



The full code of what I am using is below:



JS

get_progress.php

uploader.php



As far as I can tell, in my limited experience, this is the function that handles the submit:



postUpload : function(o_data)
{
// Loop through every input and set json response in hidden input
this.a_inputs.each((function(o_input)
{
var s_name = o_input.get('name');
var s_value = '';

if(o_file = o_data.files[s_name])
{
s_value = JSON.encode(o_file);
}


var o_jsonInput = new Element('input',{'type': 'hidden','name':o_input.origName,'value':s_value}).replaces(o_input);


}).bind(this));

// Make form "original" again by purging elements and resetting attributes
this.revertSubmit();
this.o_form.submit();
},


I noticed that the submit was this.o_form.submit(); rather than this.form.submit(); and checked it out and he has declared o_form : {} at the top of the class, so I assume that his syntax is correct but I have no real idea.



Prior to my implementing this progress tracker the form worked perfectly, so this has got me quite frustrated.



Essentially what has gone wrong, I can only assume that it's something as simple as a missing ; or similar mistake.



If you get a 404 on the submit that means it worked. I have temporarily unblocked the page for troubleshooting.



As it may be relevant, my site uses WordPress.





1 comment:

  1. Biztalk server online training - 21st Century Software Solutions
    www.21cssindia.com/courses/biztalk-server-online-training-213.html
    biztalk server online training, biztalk server training, biztalk server online training visakhapatnam, biztalk 2010 online training, microsoft biztalk online training, ...
    Biztalk admin online training - 21st Century Software Solutions
    www.21cssindia.com/courses/biztalk-admin-online-training-220.html
    biztalk admin online training, biztalk admin training, biztalk server online training, biztalk server training, biztalk admin course contents, biztalk admin enquiry, ...

    ReplyDelete