Im trying to do the followinng
but I can't do it dunno why, Im using Bindings and Im making the newbinding and all, but I can get the pop up window. dunno why
this is what I have in the html
and this is what I have in teh wod
Body : WOBody {
framework = "WOExamplesHarness.framework";
filename = "aqua_bg.jpg";
newBinding = onLoad;
}
Regards
Gus
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
        <head>
                <title>Hello World</title>
        </head>
        <body>
        <webobject name = "Body">
<webobject name = "HelloImage"/>
<br>      
Hello, what is your name?.
<webobject name = "HelloWorldForum">
        <webobject name = "NameField"/>
        <webobject name = "HelloWorldSubmitButton"/>
        
</webobject>
</webobject>
        </body>
</html>

Introduction to JavaScript and WebObjects

First, let's revisit the Hello application created in Chapter 1, "A Web Objects Primer." We are going to return the greeting in the form of a JavaScript pop-up window instead of a second page.

Dynamically Vended JavaScript Alert Panel

Duplicate the Hello project and rename it DynamicHello by following the instructions in Chapter 1.

Open Main.wo in WebObjects Builder. We are going to use an onLoad script to perform the JavaScript alert.

Add the following key to the Main page:


Name: onLoad



Type: String (java.lang.String)



As Variable: NO



Accessors: Only the Method returning the value


Now bind the onLoad key to the WOBody element. Because onLoad isn't a defined binding for WOBody (that is, you wouldn't see it listed in the WOBody Inspector) we need to add it to a new binding.

From the binding drop down, select Connect to new Binding …. Enter onLoad into the Attribute field in the Inspector. This will bind the onLoad key to the custom binding onLoad of the <BODY> element.

Copy the following lines into the onLoad() accessor:

public String onLoad() {
  String username = (String) valueForKeyPath("session.username");
  String onLoad = "javascript: alert('Hello " + username + "!');";

  return (username != null) ? onLoad:null;
}


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to