Pergunta

I searched all over net and tried many things but nothing is working out... In my .xhtml page there are 7 links which are JSf command links as below,

    <h:commandLink id="HeaderLink" value="Header">
        <f:ajax render="orderHeaderVOString" 
            onevent="updateHeaderVO"
            listener="#{OrderMBean.getOrderHeaderData}" />
    </h:commandLink>
    &nbsp;&nbsp;
    <h:commandLink id="orderLinesLink" value="Lines">
        <f:ajax render="orderLinesVOString" 
            onevent="updateLinesVO"
            listener="#{OrderMBean.getOrderLinesData}" />
    </h:commandLink> 

input hidden fields as below

    <h:inputHidden value="#{directCustViewOrderMBean.headerVOString}"
        id="orderHeaderVOString" />
    <h:inputHidden value="#{directCustViewOrderMBean.linesVOString}"
        id="orderLinesVOString" />

and javascript methods as below

    function updateHeaderVO(data) {
          if (data.status == 'success') {
        var orderHeaderVOString =    document.getElementById('viewOrderForm:orderHeaderVOString').value;
            var parsedJSON = eval("(" + orderHeaderVOString + ")");
             alert("success");
             }}

my problem is when i keep navigating through the pages after changing some 4 to 5 pages, i am getting the error "syntax error: unexpected end of input". This is because listener method is not getting called and the data inside 'viewOrderForm:orderHeaderVOString' will be empty. why sometimes its is getting called and sometimes its not getting called?

Foi útil?

Solução

I got the solution, its working fine now problem was with

<h:inputHidden feilds

as each time i navigate through the pages the value keep residing in the hidden feilds so the ajax call was not happening. now i am nullfying the hidden feilds each time.so its working fine,ajax call is happening.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top