I have a form which I want to submit on bodyLoad.
I have written document.forms[0].submit()
which works fine with IE 9 and Chrome 14 but same is not working in FF 3.6.23.
Any ideas? Is this a known issue with FF?
I have tried other options like document.form_name.submit()
and document.getElementById('form_id').submit()
but nothing works with FF.
The error I am getting in FF is
document.forms[0]
is undefined
This is what I have written in the view (CakePHP 1.2.6):
<?php $this->layout = 'blank'; ?>
<?php e($form->create('Mymodel', array('name'=>'myform', 'url'=>'gohere'))); ?>
<?php e($form->hidden('name', array('value'=>$name))); ?>
<?php e($form->end()); ?>
<script language="javascript">
document.forms[0].submit();
</script>