user2483213
user2483213

Reputation: 331

Clear form on success submit in grails

Is there is some way to clear fields after success submit in grails application?

<g:formRemote name="songList" url="[controller: 'SongList', action:'create']"
              update="[success: 'updateSongList', failure: 'error']">
    <div class="form-group">
        <label for="songList">Enter name of song list:</label>
        <g:textField name="title"  class="form-control" id="songList"/>
    </div>
    <g:submitButton name="Create" />
</g:formRemote>

or I should write custom code for this? In grails tag g:formRemote there is method onSuccess, but how correct use it in this case don't imagine.

Thank you.

Upvotes: 0

Views: 526

Answers (1)

dsharew
dsharew

Reputation: 10665

Just put this:

$('form[name="songList"]')[0].reset()

with in your success method: updateSongList()

Upvotes: 2

Related Questions