how to pass params using action button in grails

Viewed 17116

been having toruble with the button that has action. I have several btns which I want to know its paramaeter. In grails tutorial it says it should be like this:

 <g:actionSubmit    action="action" value="${message(code: 'default.button.edit.label', default: 'Edit')}" params="['actionTaken':editPhone]"/>

I tried using remotelink, submitButton, submitToRemote tags but none works. I always get null when I try parsing it in my controller:

def action=
    {
        def actionTaken = params.actionTaken
        def employeeId= params.employeeId

        MySession session = MySession.getMySession(request, params.employeeId)
        profileInstance = session.profileInstance

        switch(actionTaken)
        {
            case "editPhone" :
                isEditPhone=true
                break

            case "editEmail" :
                isEditEmail=true
                break
        }
        render(view:"profile", model:[profileInstance:session.profileInstance, isEditPhone:isEditPhone, isEditEmail:isEditEmail])
    }

What am I missing? is my params code wrong? Is my code in parsing params wrong? this just gets me in circles with no progress. help. thanks.

5 Answers
Related