Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2007

Tip: Looking for answers? Try searching our database.

Javascript inside struts

Thread view: 
Jean-François Michaud - 29 Jan 2007 16:25 GMT
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 - 29 Jan 2007 20:44 GMT
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,
>
[quoted text clipped - 54 lines]
> Regards
> Jean-Francois Michaud


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.