Grails: save to Database without page reloading

How can i save the textfields and checkboxes to the DB without reloading the page?

Just to click on the button and then its in the DB. Nothing more. I don't get it. This means when I have a textfield where I type in a content -> then click the button, the content from the textfield should be in the DB and should do nothing more (not reloading the page, or go to top for example).

I don't get it.


When I have a a <div> tag with the id="testid" in the standard create.gsp:

def create() {
  def mytestInstance = new Mytest(params)

and the <g:remoteLink> which should save this part looks like:

<g:remoteLink class="button" name="myForm" update="testid"
              url="[controller:'mytest', action: 'create']" value="....." />

That does not work because the page is refreshing or something like this and the things are not stored in the DB, plus they are not in the textfields any more.


Use <g:formRemote> or <g:submitToRemote> to do the form submission with an Ajax call.

You should be able to use the formRemote tag to send the data to a controller via Ajax


As it says on that page;

This tag also requires the use of either the <g:javascript/>(link) or <g:setProvider/>(link) tags. See the AJAX section of the user guide to find out more.

Have you done that?

Need Your Help

Is this a standard C++ code?

c++ standards standards-compliance

The following simple piece of code, compiles with VC2008 but g++ rejects the code:

Setting <Window.DataContext> in XAML

wpf mvvm datacontext

I followed a very simple MVVM example as a basis for my program. The author had one code behind instruction he used in the main page to set the DataContext. I'm thinking I should be able to do this...