Javascript inside struts

  • Thread starter =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=
  • Start date
?

=?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=

Hello,

I've been trying to figure something out for the past few days and I
can't seem to pinpoint what I'm doing wrong.

I've been trying to call javascript from inside a <logic:equal>, but
it doesn't seem to work like I want.

I've tried calling an alert('hello'); to test out if my call worked
correctly, and it does, but when I call my own javascript functions
that I create in the html/head, they don't seem to get executed. Any
idea why (except disbaleCif() which I call through onload)?

Here's a snippet of code:

<html>
<head>
<link REL="stylesheet" HREF="css/bear.css" TYPE="text/css">
<script type="text/javascript">
function disableCif()
{
document.ManageKQADocumentForm.cifType1.disabled="true";
document.ManageKQADocumentForm.cifType2.disabled="true";
document.ManageKQADocumentForm.cifType3.disabled="true";
}

function enableCifType1()
{
document.ManageKQADocumentForm.cifType1.disabled="false";
}

function enableCifType2()
{
document.ManageKQADocumentForm.cifType2.disabled="false";
}

function enableCifType3()
{
document.ManageKQADocumentForm.cifType3.disabled="false";
}
</script>
</head>
<body class="MainBody" onload="javascript:disableCif();">
<logic:iterate id="cifType" property="checkItemFormTypes"
name="manageKQADocumentTO">
<logic:equal value="1" name="cifType">
<script> alert('hello'); </script>
</logic:equal>
<logic:equal value="2" name="cifType">
<script> enableCifType2(); </script>
</logic:equal>
<logic:equal value="3" name="cifType">
<script> enableCifType3(); </script>
</logic:equal>
</logic:iterate>

Regards
Jean-Francois Michaud
 
C

ceasaro

How does the generated html page look like? if you view the source
from you're browser does it show the write javascript? If so you're
issue is not the concerning the struts framework but you should debug
the javascript it self. Maybe the browser you use is very strict in
how to use javascript.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top