开发者

Issues in hook_form_submit() in IE browser

i have a custom module with a form I have implemente开发者_Go百科d form hooks like this

hook_form()
hook_form_submit($form, &$form_state)

When i have a print statement in _submit it doesnt show on the screen , but which works fine in mozilla firefox . In IE _submit is only not getting called , am using drupal_render to render each form elements individually

Edit:

<?php echo drupal_render($form['form field']);?>

Am rendering form in this method, initially couldnt submit forms in ff also read some where to add these lines

<?php print drupal_render($form['form_build_id']); print drupal_render($form['form_id']); print drupal_render($form['form_token']); ?> So i blindly added them ,afterwards it works in ff not in IE


Browsers wont effect what code and functions are executed on your server. It only makes a request, what happens after that will be the same.

What can differ is how they render a page. Since submit functions are run before the page is rendered, the markup that you print, will be printed before the html document is created. This is most likely why you are seeing different results, you are creating invalid markup.

Try looking at the source code and compare, I'm sure they are the same.


I recommend that you use the Devel module while debugging stuff like this. Once the module is enabled, enable the Development block as well. In the module's configuration page, enable the "Display redirection page" setting which should allow you to intercept the form submission page before the API redirects you elsewhere.

Also, I'd suggest not worrying about the drupal_render and just testing with a diagnostic print. Rather than plain print() statements, it is recommended that you use Devel's dpm() function during debugging.

You can also check what's happening in hook_validate() before you reach hook_submit().


Need to see form function, form validate, submit, pre render, after build, theme (template + preprocess) functions to tell what is the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜