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 Australia

seen from Italy
seen from Germany
seen from United States
seen from China
seen from Indonesia

seen from Malaysia

seen from Malaysia
seen from Malaysia
seen from United States
seen from Maldives
seen from Vietnam
seen from United States

seen from Malaysia
seen from Germany
seen from China
seen from Canada

seen from Montenegro

seen from Malaysia

seen from Malaysia
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('') })

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
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() })