简体   繁体   中英

Zend_Form not submitting

I built a custom Zend_Form "myForm" and I passed it to my view with:

$this->view->form=new myForm();

Problem: form is not submitting (page doesn't reload/refresh).I thought something was wrong with the "form" tags,but I copyied the bottom code in another page (that is not a Zend environment) and is working.This is the source code:

<form enctype="multipart/form-data" method="post" action="">

<input type="text" name="title" id="title" value="" class=""> 
<textarea name="text" id="text" class=""></textarea>
<input type="text" name="allegati" id="allegati" value="" class="">
<input type="hidden" name="MAX_FILE_SIZE" value="2097152" id="MAX_FILE_SIZE">
<input type="file" name="file" id="file" class="media[]"></span>

<input type="submit" name="submit" id="submit" value="submit" class="">
</form>

SOLVED: As some of you guys suggested javascript is giving problems: I had a js script overriding with:

$('form').submit();

Thanks

Luca

Form submitting issues are 99% related to javascript conflicts with the 'form' element or with a wrong defined 'form' tag. Always check those above when encountering problems.

Ps for the remaining 1% feel free to ask at Stack!

Best regards

Just a suggestion - try to rename your submit button to something but not "submit" (ie name="mysubmitbutton"). I think the problem could be with expandos: http://ejohn.org/blog/deadly-expandos/ . By default, a form element has a submit function. But, if you call any field inside your form with the name "submit" (like you do in your example), the form.submit will point to your input element and you'll not be able to submit your form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM