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