Re: Question here
Re: Question here
- Subject: Re: Question here
- From: David LeBer <email@hidden>
- Date: Mon, 10 Mar 2008 17:20:37 -0400
On 10-Mar-08, at 5:04 PM, Gustavo Pizano wrote:
I'd keep this on the WebObjects-dev list as it seems to be more
generic WO than WOLips specific.
You are using Ravi Mendis' book I see.
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;
}
This should be:
Body : WOBody {
framework = "WOExamplesHarness.framework";
filename = "aqua_bg.jpg";
onLoad = 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;
}
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden