Re: Accessing ComponentActionUrl Through JavaScript
Re: Accessing ComponentActionUrl Through JavaScript
- Subject: Re: Accessing ComponentActionUrl Through JavaScript
- From: Zak Burke <email@hidden>
- Date: Fri, 19 Aug 2005 09:28:00 -0400
Jonathan Fleming wrote on 8/18/05 11:03 PM:
> Hi guys,
> How can I get a component url from a javascript function?
> This is what I'm trying to achieve:
>
> <script language="text/javascript">
> function
> fckWOFileUploadComponent(){window.location="woscripts/WebObjects.exe/MYAPPNAME.woa/-9795/wo/sXzn3R36J1YYFttCnrgfx0/11.0.2.31.20.0.3.0.4.0.1.2.0"}
>
> </script>
Apple's code for the JSModalWindow WO Extension, which I think is
similar to what you're trying to do, is available in the WO Examples. On
my box, that installed here:
/Developer/Examples/JavaWebObjects/Source/JavaWOExtensions/JavaScript.subproj/JSModalWindow.java
HTH,
zak.
>
> I've already tried something like this in my bindings:
>
> JavaScript_fckWOFileUploadCompActionUrl: WOJavaScript {
> scriptString = fckWOFileUploadUrlCompAction;
> invokeAction = ^aComponentActionName;
> }
>
> Where the code looks like this for the WOJavaScript bindings
>
> public static String fckFileUploadCompActionUrl(WOContext context) {
> String uploadUrl = context.componentActionURL();
> return "function
> fckWOFileUploadComponent(){window.location=\""+uploadUrl+"\"}";
> }
>
> and tried using this:
>
> Generic_fckJSUploadFucnction: WOGenericContainer {
> elementID = fckUploadElementID;
> elementName = "script";
> invokeAction = ^aComponentActionName;
> otherTagString = "language=\"text/javascript\"";
> }
>
> Where the code looks like this for the WOGenericContainer bindings
>
> protected Object valueForBindingOrNull( String binding ) {
> Object bindingValue = valueForBinding( binding );
> return ( bindingValue instanceof Boolean ) ? null : bindingValue;
> }
>
> public String aComponentActionUrlString() {
>
> // Return aComponentActionUrl if found
> if ( hasBinding( "aComponentActionUrl" ) ) {
> return String.valueOf( valueForBindingOrNull(
> "aComponentActionUrl" ) );
> }
> // Otherwise return the action url
> return new String( context().componentActionURL() );
> }
>
> public String fckUploadElementID;
> public String fckWOFileUploadCompActionUrl() {
> return "function
> fckWOFileUploadComponent(){window.location=\""+aComponentActionUrlString()+"\"}";
>
> }
>
> But I'm getting no joy...
> The WOJavascript one works partially but it is only returning
> context().componentActionURL() rather than the url for the named method
> I want to link to, this is what is gives me:
> <SCRIPT language=JavaScript invokeAction="<DataForm name: DataForm
> subcomponents: null >">
> function
> fckWOFileUploadComponent(){window.location="/woscripts/WebObjects.exe/MYAPPNAME.woa/-9795/wo/sXzn3R36J1YYFttCnrgfx0/11.0.2.31.20.0.3.0.4.0.1.2.0"}
>
> </SCRIPT>
>
> and the other is doing the same but also showing the quotes
> ("actionUrl") as " ("actionUrl") which is causing script
> errors
>
> Anyone know of a correct way to achieve such a feat?
>
> Kind regards
> Jonathan :^)
>
>
> _______________________________________________
> 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
_______________________________________________
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