Home Grails 2.x submit form with additional parameters
Reply: 0

Grails 2.x submit form with additional parameters

user1619 Published in March 20, 2018, 5:13 pm

I am a newbie to grails I want to make a form that submit form params plus other params in a gsp

the gsp looks like this:

<g:form url="action:'myAction',controller:'myTerms', params:[params: params, myCheckbox: myCheckbox]">
                    <p><g:checkBox id="myCheckbox" name="myCheckbox" value="true" checked="checked"/><g:message code="terms.agree"/><a style="color: #ed1c24" href="/xyz"><g:message code="terms.termsConditions"/></a><g:message code="terms.ofService"/></p>
                    <g:actionSubmit value="Subscribe" />

it should submit to controller named MyTermsController to the action below:

def myAction(){
        if(/*condition 1*/){
                if (/*condition 2*/) {
                    //more code
            }catch (AlreadyPurchasedException ape){
                redirect(controller: "controllerA", action: "showXhtml", params:params)
            redirect(controller: "controllerB", action: "handlePaymentXhtml", params: params)
        }else if(/*condition 3*/){
            redirect(controller:"controllerC", action:"purchaseXhtml", params:params)

What I am trying to do is to submit a form with params without using javascript.

now every time I press submit, the application is redirected to the error page telling me that the page is not found.

can anyone tell me what am I missing/doing wrong?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.331876 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO