Clear all input boxes
Sometime we'd like to have a "clear" Button to clear all input boxes in our form. Here's a quick way to do so. $("button[label='Clear']").on('click', { $('textbox, intbox, decimalbox, datebox').text('') })

seen from United States

seen from Japan
seen from China
seen from Germany
seen from United States

seen from Latvia
seen from United States
seen from United States

seen from United States

seen from Netherlands
seen from United States

seen from United States
seen from Canada

seen from Netherlands

seen from United States
seen from Bulgaria
seen from China
seen from Yemen

seen from Sweden
seen from United Kingdom
Clear all input boxes
Sometime we'd like to have a "clear" Button to clear all input boxes in our form. Here's a quick way to do so. $("button[label='Clear']").on('click', { $('textbox, intbox, decimalbox, datebox').text('') })
Saving a Domain class
Here's a way to get data from UI compoments, assign them to a Grails domain class and save. If there's an error the first error message will be displayed by the notification block. $('#save').on('click', { def product = new Product( name: $('#name' ).val(), category: $('#category').val(), unit: $('#unit' ).val() ) if(product.save(flush: true)) { notify("New Product ${product.name}: ${product.id} Saved") $('#name, #category, #unit').val(null) $('#name').focus() } else { def e = product.errors.allErrors[0] def comp = $("#${e.field}") notify(message(error:e), comp) comp.focus() } })
Handle click of a Button
Basically, we always want to handle some UI events in our applications. In ZKGrails 2, we use a similar syntax to jQuery for handling event of UI compoments. Here's how to have a click handle for component Button with id **btnSave**. $('#btnSave').on('click', { obj.save() })