[EMAIL PROTECTED] schrieb:
Hi!

I tried to use the onClick Event from selectOneListBox for navigation, but the action method get not called:
>
<script type="text/javascript">
                  function executeCommandLink(idLink,formName){
document.forms[0].elements[formName+':_link_hidden_'].value=idLink;
            if(document.forms[formName].onsubmit){
                document.forms[formName].onsubmit();
            }
            document.forms[0].submit();
            return false;
} </script>

I guess your problem is related to identifiers. In javascript you have to use the clientIds of the components. The clientId is NOT the same as the id you gave the component. It is composed of the ids of all naming containers which are parents of the component and the component id itself with : in between. For you this should be (as subview and form are naming containers adding their id to the clientId):

subViewSelect:fSelect
subViewSelect:fSelect:cmdLink1

One hint: look at the rendered html code of your page. MyFaces renders javascript to submit a form with a commandLink - that should be what you need (or close to it ;-) ). And here's another one: try to get familiar with the id concept of jsf (clientId, naming container...). This will help you a lot.

The following code should work (it is only a quick hack!!):

function submitIt(idLink, formName) {
  var form = document.forms[formName];
  form.elements[formName+':_idcl'].value=idLink;
  form.submit();
}

when you call:

submitIt('subViewSelect:fSelect:cmdLink1', 'subViewSelect:fSelect');

have a nice evening, regards
Michael Kurz

Reply via email to