views:

35

answers:

3

i have a custom module with a form I have implemented 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

+1  A: 

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.

googletorp
OK , but i am not able to debug it any more , i only know that it s not entering _submit function , so am a bit confused like where what has gone wrong
kantu
@kantu: Try doing a `die()` in the submit function, if you are correct, IE will produce a page while Firefox wont. I doubt that will happen though.
googletorp
A: 

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().

Jubal Harshaw