开发者

How to define in Grails an uploadForm and 2 different actions?

I have a gsp view, with an , and 2 input text. I have a button to save and submit.

Now I would like to add another button with a new action, in my case a button to schedule save.

Note : in my controller I have define : def save (corresponding to button action save) and def schedule (corresponding to button action schedule).

What is the best way to add Schedule in this gsp view :

<g:uploadForm action="save" method="post" >
    <div class="dialog">
        <table>
            <tbody>

              <tr class="prop">
                <td valign="top" class="name">
                  <label for="payload">File:</label>
                </td>
                <td valign="top">
                  <input type="file" id="payload" name="payload"/>
                </td>
                <td valign="top">
                  <input type="file" id="payload2" name="payload2"/>
                </td>
              </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="lvalue">Lvalue:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean:rmmInstance,field:'lvalue','errors')}">
                        <input type="text" id="lvalue" name="lvalue" value="${fieldValue(bean:rmmInstance,field:'lvalue')}" />
                    </td>
                </tr> 

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="wvalue">Wvalue:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean:rmmInstance,field:'wvalue','errors')}">
                        <input type="text" id="wvalue" name="wvalue" value="${fieldValue(bean:rmmInstance,field:'wvalue')}" />
                    </td>
                &开发者_如何学运维lt;/tr> 

            </tbody>
        </table>
    </div>
    <div class="buttons">
        <span class="button"><input class="save" type="submit" value="Run Now" /></span>
    </div>
</g:uploadForm>

I have just one form, but 2 different actions.

Thanks !


With an actionSubmit:

Purpose

Creates a submit button that maps to a specific action, which allows you to have multiple submit buttons in a single form. Javascript event handlers can be added using the same parameter names as in HTML.

From the Grails reference docs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜