0

I have a situation where I am suppose to submit a user's payment details to my payment gateway partner.

For this I have a separate non JSF form with hidden values as parameters to be passed.

<form id="hiddenForm" action="#{checkoutBean.payuAction}" method="post" name="payuForm">

                        <p:outputPanel id="hiddenPanel">
                        <h:inputHidden id="hash" value="#{checkoutBean.hash}"/>
                        <h:inputHidden id="txnid" value="#{checkoutBean.txnid}"/>

                        <h:inputHidden id="amount" value="#{checkoutBean.totoalAmount}"/>
                        <h:inputHidden id="firstname" value="#{checkoutBean.firstname}"/>
                        <h:inputHidden id="email" value="#{checkoutBean.email}"/>
                        <h:inputHidden id="phone" value="#{checkoutBean.phone}"/>
                        <h:inputHidden id="productinfo" value="#{checkoutBean.productInfo}"/>
                        <h:inputHidden id="surl" value="#{checkoutBean.sURL}" />
                        <h:inputHidden id="furl" value="#{checkoutBean.fURL}"/>
                        </p:outputPanel>
    </form>

The above hidden values are generated using ajax at the last step in a wizard (primefaces). The ajax call is happening but I am unable to update the non JSF form. The values are null.

<p:commandButton value="Confirm" actionListener="#{checkoutBean.initPayu}" onsuccess="submitPayuForm()" update=":hiddenForm:hiddenPanel" />

The above button is in a <h:form>.

Now i believe that it is not possible to update non JSF components from JSF components. But I just can't figure out how to tackle this scenario.

Any ideas on how I can tackle this problem?

Using : JSF 2 , Primefaces 3.3

Thanks a ton in advance.

Akshat
  • 248
  • 5
  • 18

1 Answers1

1

Since your form is not a JSF component you don't need to append its id to ids of your JSF components (:hiddenForm:hiddenPanel).

In other words, try something like this:

<p:commandButton ... update="hiddenPanel" />
axtavt
  • 228,184
  • 37
  • 489
  • 472
  • That doesn't work. javax.faces.FacesException: Cannot find component with identifier "hiddenPanel" referenced from "wizForm:j_idt62". – Akshat Nov 07 '12 at 09:04
  • 1
    Akshat, carefully read this http://stackoverflow.com/questions/8634156/how-to-reference-components-in-jsf-ajax-cannot-find-component-with-identifier/8644762#8644762 and then look in the generated HTML source. I guess that you actually need `update=":hiddenPanel"`. – BalusC Nov 07 '12 at 17:24
  • Thanks man. The link explains it all. I had started to believe that non JSF forms cannot be updated by JSF components. Can you just write a 2 line answer with that link, I'll accept it as an answer. Cheers! – Akshat Nov 08 '12 at 06:52