Hi,

I want to write the below javascript code into my JSP page directly...Can you please help?

JSP code...

<span class="mini">
<html:link href="#" styleClass="bouton" onclick="return submit_form_with_parameters('delegationForm', 'delegation', 'noInit=Y');">
<bean:message key="rh2u.deleg.label.etape0.label.chercher" />
</html:link>
</span>

JavaScript code...

function submit_form_with_parameters(strFormName, strAction, parameters){
	objForm = eval("document." + strFormName);
	objForm.action = strAction + ".do?" + parameters;
	objForm.submit();

I want to write the function submit_form_with_parameters directly into JSP page.

Please help.

put this in in your JSP page:

<%=
"function submit_form_with_parameters(strFormName, strAction, parameters){
objForm = eval(\"document.\" + strFormName);
objForm.action = strAction + \".do?\" + parameters;
objForm.submit();
"

%>

OR

<%
         String jsCode = "function submit_form_with_parameters(strFormName, strAction, parameters){
objForm = eval(\"document.\" + strFormName);
objForm.action = strAction + \".do?\" + parameters;
objForm.submit();
";

%>

<%=jsCode%>

what would prevent you from just using html, as in

<script type="text/javascript">
...js code...
</script>

???

Actually icorey is also correct. If u have to display static HTML its good to write in icorey way.

Thanks guys...I did as icorey said.....now the problem is .....when i click on the submit button...I can not see the internet explorer progress bar...but when I execute the same in Mozilla firefox, I can see the progress bar. and process is getting completed in both the cases.
My users are using internet explorer and can not see the progress.....
Is there any change required to be done?

thanks for your help.

Thanks guys...I did as icorey said.....now the problem is .....when i click on the submit button...I can not see the internet explorer progress bar...but when I execute the same in Mozilla firefox, I can see the progress bar. and process is getting completed in both the cases.
My users are using internet explorer and can not see the progress.....
Is there any change required to be done?

thanks for your help.

no. that's defined by the browser. Most likely IE is just faster than is FF (wouldn't surprise me, it is faster in my experience) so it's getting a response and processing it before it gets a chance to display the bar.

thanks for your mail....but the problem is ....it is displaying results after 15-20 seconds.....in both the cases of IE and Firefox. Results are coming at equal time in both but IE is not showing the progress bar.
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.