Details
Description
Currently to create a submit button for an Ajax form you would use the g:submitToRemote tag but it's quite common for applications to have their own customised submit button which submits a form using a standard <a> link.
Maybe there's some merit in having a submitToRemoteLink tag in the core Grails tag library which creates an <a> tag with all the JavaScript to submit the form via Ajax when clicked. I.e.(I have created this in my own tag lib which extends JavascriptTagLib)
def submitToRemoteLink = { attrs, body ->
// get javascript provider
def p = getProvider()
// prepare form settings
attrs.forSubmitTag = ".form"
p.prepareAjaxForm(attrs)
def params = [onclick: remoteFunction(attrs) + 'return false',
href: 'javascript:void(0);',
name: attrs.remove('name'),
id: attrs.remove('id'),
'class':attrs.remove('class')]
out << withTag(name:'a', attrs:params)
{ out << body() }
}
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits