<@link_to/> wrapping a form using an ajax call with after function called to append

44 views
Skip to first unread message

Gianna Giavelli

unread,
May 16, 2015, 3:33:00 AM5/16/15
to acti...@googlegroups.com
I'd really like to do a form surrounded by <@link_to/> and specify the form. And then have the ajax return the new html to append to a div on the page. 

Do we have an example of this anywhere? 

Do I have to write anything special to make clicking on the submit button of the form trigger the <@link_to/> ajax call? 

Thanks

Gianna Giavelli

unread,
May 16, 2015, 3:36:23 AM5/16/15
to acti...@googlegroups.com
Sorry, I shouldn't say use @link_to to surround the form, I mean specify the form id. But I dont want a link_to tag to appear on the page either I want it all triggered off form submit button. Then the after function call will manage the jquery page update with the html returned from the function. 

  • form : id of a form element on the page, whose content will be serialized into the Ajax call. This content will be submitted to the server controller/action as input. Optional.

Gianna Giavelli

unread,
May 16, 2015, 5:23:03 AM5/16/15
to acti...@googlegroups.com
so ... do I put the Link_to within my form as the "submit" link? 

Igor Polevoy

unread,
May 17, 2015, 9:56:37 PM5/17/15
to acti...@googlegroups.com
Gianna the placement of the link_to tag on page as it relates to a form is irrelevant. 

tx 

Gianna Giavelli

unread,
May 20, 2015, 4:55:20 AM5/20/15
to acti...@googlegroups.com
thanks will look. I'm sure once I see an example it will be clear. I assumed placement did not matter. I don't have a lot of time to go back to things I had trouble with, so the example will help.

Gianna Giavelli

unread,
May 20, 2015, 5:41:13 AM5/20/15
to acti...@googlegroups.com
OK Got it! 

I was adding a 200 response code to my response. I took that out and it all worked fine. thanks!

Mattias coudron

unread,
Nov 19, 2015, 4:00:30 PM11/19/15
to ActiveWeb Group
Hi Igor,

I'm new to this.
I have a form that contains records that have to be submitted to the web application.
<#list salespointpromotionmaterials as salespointpromotionmaterial>
                     
<tr>
                         
<td>${promotionmaterials[salespointpromotionmaterial.PROMO_MATERIAAL_ID].omschrijving}</td>
                         
<td>
                             
<div class="checkbox">
                                 
<label><input type="checkbox" value="J" name="promomat[salespointpromotionmaterial.PROMO_MATERIAAL_ID][mogelijk]" <#if salespointpromotionmaterial.MOGELIJKHEID_FLAG??>CHECKED</#if>></label>
                           
</div>
                         
<td>
                             
<div class="checkbox">
                                 
<label><input type="checkbox" value="J" name="promomat[salespointpromotionmaterial.PROMO_MATERIAAL_ID][bereid]" <#if salespointpromotionmaterial.BEREIDHEID_FLAG??>CHECKED</#if>></label>
                           
</div>                          
                         
</td>
                     
</tr>
                  </#list>

I made a @link_to that does an ajax request i thought i had to use the form option to submit the form to the controller?
How can i read the values of this form in the controller?

Thank you.


Igor Polevoy

unread,
Nov 19, 2015, 11:28:45 PM11/19/15
to ActiveWeb Group
Hi, Mattias. 


First, I did not find a form in your example. Second, we actually have a pretty good documentation forLinkToTag  Ajax behavior. 

Please, see this


Also, please ensure you are loading aw.js sfript file into your page: https://github.com/javalite/kitchensink/blob/master/src/main/webapp/js/aw.js

I hope this helps,

igor
Reply all
Reply to author
Forward
0 new messages