views:

207

answers:

1

Hi there.

I need to set a Bean value with one javascript return value.

Something like:

<script type="text/javascript">
  function getUserId(){
     return 4;
  }
</script>

<h:inputText name="lala" value="getUserId()"/>

Thanks

A: 

I solved it.

I was using a:jsFunction tag as it follows:

  <script type="text/javascript">
        function getUserId(){
                var user = MyCompany.get_User();
            return user;
        }
    </script>

<a:jsFunction action="#{user.performLogin()}" name="doSiteLogin"  >
   <a:actionparam name="uid" value="getUserId()"/>
</a:jsFunction>

If you use the property noEscape="true" on the a:actionparam ... it call your javascript code.

João Madureira Pires