Claus

>         onChange = "window.document.myform.submit()"
>         action = doSelect

WOPopUpButton's don't actually HAVE 'actions' in the WO server-side
sense. WO is treating 'action' like any other binding. It thinks a
method on your page called 'action' is going to return some important
info it needs to display itself. So leave that binding off. Instead add
binf 'doSelect' to the action= binding of the FORM that you are
submitting.

For a VERY handy new WOElement to use when doing JavaScript programming,
check out WOActionURL. It basically lets you lay a WO URL pointing
directly to the action you desire anywhere on your page....

Here's a hypothetical HTML template with some buggy JavaScript code:

<SCRIPT>
Some JS SOme JSSome JS SOme JSSome JS SOme JSSome JS SOme JS ... Now I
need a URL here=<WEBOBJECT name=aURL></WEBOBJECT> Some more JS some more
JS
</SCRIPT>


Here's the .wod

aURL:WOActionURL{
        action = doFoo;
}

Your WOActionURL also has a 'pageName' binding and a 'directAction'
binding.


d

Claus Priisholm wrote:
> 
> Hi
> 
> What is the best approach to use JavaScript to activate an action when
> the user alters the selection in a pop-up (or other components that
> supports the onChange event).
> 
> In plain non-JavaScript'ed mode we have a pop-up along with a 'Select'
> button in a form. Clicking the 'Select' button selects whatever is
> selected in the pop-up. Works fine.
> 
> If Javascript is enabled in the browser I would like the selection to
> take place as soon as the user makes the selection in the pop-up, and I
> do not want the 'Select' button to appear.
> 
> So far I have two approaches, but neither really makes a home run.
> 
> 1) Name the form (e.g. 'myform'), enclose the button with NOSCRIPT tags,
> and add two attributes to the popup in WOBuilder:
> 
>         onChange = "window.document.myform.submit()"
>         action = doSelect
> 
> Works fine and it calls doSelect when the user alters the selection in
> the popup. The problem is that WOPopUpButton binds the action like a
> normal attribute and actually calls the method when the page it is on,
> is being built. As doSelect returns a new page and possibly performs
> some complex database queries this is not desirable.
> 
> 2) The second approach is similar, except the button is named and not
> enclosed by the NOSCRIPT tags, the attributes on the popup is:
> 
>         onChange = "window.document.myform.mybutton.click()";
> 
> This does not have the side effect of the previous approach, but the
> button cannot be hidden as it is used.
> 
> Beside using approach 2 and making the button a small, invisible image,
> does anyone know of a  cleaner approach?
> 
> ---
> Claus Priisholm
> [EMAIL PROTECTED]
> http://www.frontline-software.dk

Reply via email to