Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Javascript inside struts (http://www.velocityreviews.com/forums/t390437-javascript-inside-struts.html)

=?iso-8859-1?q?Jean-Fran=E7ois_Michaud?= 01-29-2007 04:25 PM

Javascript inside struts
 
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


ceasaro 01-29-2007 08:44 PM

Re: Javascript inside struts
 
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.

On Jan 29, 5:25 pm, "Jean-François Michaud" <come...@comcast.net>
wrote:
> 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




All times are GMT. The time now is 03:40 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.