You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by madan chowdary <ma...@yahoo.com> on 2007/03/02 12:57:56 UTC

[Tobago] Form submit using JavaScript

Hi All,

I have a usecase which does as follows,

-> User has to enter an orderID
->If orderId is already present in the database, then he should be asked to confirm with the same orderId or cange the orderId.
->This would be asked with a javascript confirm dialog .
-> if  'Ok' is clicked, the form must be submitted. else if 'Cancel' does not do any thing.

The first time he enters with the po number, it should go to the server process , if poNumber already exists, then it should come back to the same page , render all the text and then show the javascript confirm dialog asking to choose the above case.

I was able to achieve this as under

<tc:cell>
    <tc:panel>
        <f:facet name="layout">
            <tc:gridLayout/>
        </f:facet>
        <tc:cell>
            <tc:button label="#{bundle.buy}" action="#{checkout.buyAction}" id="buyButton">
                <tc:attribute name="renderedPartially" value=":page:confirmPoNumberExists"/>
            </tc:button>
        </tc:cell>
    </tc:panel>
</tc:cell>
<%-- poNumberExists Confirmation --%>                    
<tc:cell>
    <tc:panel id="confirmPoNumberExists">
        <f:facet name="layout">
            <tc:gridLayout rows="10px;10px;" border="1"/>
        </f:facet>
        <tc:cell rendered="#{checkout.poNumberExists}">
            <tc:out value="true"/>
        </tc:cell>
        <tc:cell rendered="#{!checkout.poNumberExists}">
            <tc:out value="false"/>
        </tc:cell>
    </tc:panel>
</tc:cell>
Just for testing i kept as follows to print true or false, when i click on buy button, was able to send a request with ajax and get back the value as true or false.

But i was stuck how to proceed with "Java script confirm" and submitting the form.

Plz suggest me with this,

Thnx in Advance

Regards,
Madan




		
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/