I'm trying to submit a form with javascript. Works fine with Firefox 3.6, but doesn't work in Firefox4.0 and IE8.
Code:
<table>
<tr>
<td>
<form action='results.html' method='post' target='_blank' id='<% $question->{ QuestionID } %>'>
<input type='hidden' name='SurveyID' value='<% $surveyid %>'
<input type='hidden' name='responses' value='<% join ",", map { $_->{ srid } } @textresults %>'/>
<input type='hidden' name='question' value='<% $question->{ QuestionID } %>'/>
Total Responses: (< a href='javascript: submitForm("<% $question->{ QuestionID } %>");' >View All< /a>)
</form>
</td>
</tr>
</table>
Javascript:
<script type='text/javascript'>
function submitForm(id) {
document.getElementById(id).submit();
}
</script>
Any Idea what is wrong?
First of all close the first input tag like this: <input type='hidden' name='SurveyID' value='<% $surveyid %>'/>
. Also remove the spaces from the a
tag, here: <a href
and here: </a>