-
1. Re: passing values entered by user to a4j:jsFunction
sergeysmirnov Mar 15, 2007 2:30 AM (in response to tizi)immediate="true" means bypassing the validation and model update phases. Ie. request data should not update the beans
outputLabel onclick is formed on the server and has no relationship with inputText
So, you are double guarantied that you will NOT have what you want.
I suggest, you complicated the code too much. Most likely, if you remove h:outputLabel with a4j:jsFunction and replace them with just a4j:commandLink, you will have the #{backing_CustSearchBean.createFName} already updated when the action on the a4j:commandLink is invoked -
2. Re: passing values entered by user to a4j:jsFunction
tizi Mar 15, 2007 12:17 PM (in response to tizi)Actually this again happens to be the case where for parent tags, rendered is false initially. So I am not getting the control going to action attribute (I had posted this day before yesterday and resolved it through jsFunction).
Thats why I was trying to find the workaround through jSFunction. So if I use <h:outputtext> and remove immediate=true, will I be getting data in the managed bean? Or is there a specific way of declaring onclick="saveData()" where I can pass values entered by user.
Thanks a lot for replying. -
3. Re: passing values entered by user to a4j:jsFunction
tizi Mar 15, 2007 3:32 PM (in response to tizi)Can you please let me know how do i set the value of <h:inputhidden> in managed bean and catch it in jsp? If I can do that I'll go for normal div tags. but as of now I am not able to change the value of hidden field in managed bean...???
-
4. Re: passing values entered by user to a4j:jsFunction
sergeysmirnov Mar 15, 2007 3:42 PM (in response to tizi)I did not see the "hidden field" in the above code. Could you post the actual one that you have now
-
5. Re: passing values entered by user to a4j:jsFunction
tizi Mar 15, 2007 3:58 PM (in response to tizi)Here is the code:
<a4j:commandButton id="commandButton3" action="#{backing_CustSearchBean.serchCustomer}" image="images/btn_search.gif" style="position: relative; margin-right: 5px;" actionListener="#{backing_CustSearchBean.checkText}" immediate="true" status="wait" oncomplete="showQuickCreate()" > <h:inputHidden id="jsfHidden" value="#{backing_CustSearchBean.jsfHidden}" /> <a4j:status id="wait"> <f:facet name="start" > <h:graphicImage url="images/SpinGear2.gif" style="position: absolute; left: 378px; top: 216px; width: 19px; height: 18px;"/> </f:facet> </a4j:status> </a4j:commandButton>
inside managed bean serchCustomer action I do this:
jsfHidden.setValue("failure");
But I am not able to catch this value in the showQuickCreate javascript function ... -
6. Re: passing values entered by user to a4j:jsFunction
sergeysmirnov Mar 15, 2007 4:15 PM (in response to tizi)I still did not see the whole picture what do you have on your side. The latest code snippet has no jsFunction
-
7. Re: passing values entered by user to a4j:jsFunction
tizi Mar 15, 2007 4:18 PM (in response to tizi)This time I am using simple javascript function as shown below:
<script type="text/javascript"> function showQuickCreate(){ alert('value in the hidden object --->'+document.getElementById('jsfHidden').value ); } </script>
I dont catch the value here. -
8. Re: passing values entered by user to a4j:jsFunction
sergeysmirnov Mar 15, 2007 4:35 PM (in response to tizi)You just reference to a wrong id there.
If you have:<h:form id="myform"> <h:inputHidden id="jsfHidden" ..../> </h:form>
you have to use:document.getElementById('myform:jsfHidden').value
-
9. Re: passing values entered by user to a4j:jsFunction
tizi Mar 15, 2007 5:06 PM (in response to tizi)Hi can you please also suggest how should set it (the hidden value) in managed also?
I tried
1)HTMLHiddenInput , jsfHidden.setValue('failure')
2) private String jsfhidden , jsfHiddden = "failure"
3)session.setAttribute("jsfHidden","failure") and in jsf
<h:inputHidden id="jsfHidden" value="#{sessionScope.jsfHidden}" />
But with non of above my recent value of "jsfHidden" is shown in alert.
i.e.
alert( document.getElementById('myform:jsfHidden').value)