Can an ACTION invoke a COMMAND? ..based on WS value?

Ok… so I have a very simple portlet. All it has is a drop down and submit button.

If the drop down has more than one value the user must select one and hit submit. Submit will take them to a new page and pass the drop down value as a parameter

However…

If the drop down has < 2 values I would like that “redirect” (the Submit action) to happen automatically.

Can I:

  1. perform this redirect (call a hidden command, perhaps) from an action?

  2. perform an action based on the value returned from a WS?

Thanks for any help…

Lucas.

I think the last thread that I posted on JavaScript validation would help you in this area. You would evaluate when CAF.model(“#{activePageBean.clientIds[‘your item to use here’]}”).raise();

But instead of raise you could do a clicked/or submit from there

I don’t follow… which part of my problem would that help with do you think?

You need to have a script block on the page with the code to fire a command using javascript, as was shown:

CAF.model(“#{activePageBean.clientIds[‘commandButtonID’]}”).raise();

Now you want this script block to run only when your dropdown has < 2 elements. You can achieve this by conditionally render script block based on the size of your list for dropdown

Alex:

Thanks… how do I ensure the order of operations? I ask becuse the script block would be rendered/not rendered before the WS call, right?

Lucas.