Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Make forms 'Ajaxy'

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1498 Views
  • dio5
    Avatar
    Community Member
    501 Posts

    Make forms 'Ajaxy' Link to this post

    I'm going to want some forms of mine enhanced with ajax.

    Now I know how to do this the normal way, but haven't got a single clue on how to do it in SS. Where should I send my request to? To the controller.php? Or do I make a complete new controller for it?

    I also came across 'FormResponse' and 'AjaxActionForm' but the documentation didn't make me a lot wiser... Is there anybody here with some experience / or some examples?

    And if you know the answer, please take a look at what I'm doing wrong here: http://www.silverstripe.com/silverstripe-development/flat/5780?showPost=6157#post6157

    Thanks!

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Make forms 'Ajaxy' Link to this post

    Hm, just use the normal form action thats generated by the form, submitted by an ajax-call instead of a normal POST-request (e.g. by prototype's Ajax.Request-object).

    AjaxFormAction isn't really needed for this, afaik its mostly specific to the backend where all "normal" actions in a form are processed a bit differently to build the "button-bar" you see in the interface.

    FormResponse is a nice wrapper that lets you create responses for ajax/non-ajax calls (e.g. returning json vs. a full html-page). it determines automatically the format you need, and has some other useful functions like refreshing a cms-form with reapplying javascript-behaviour.

    http://doc.silverstripe.com/doku.php?id=formresponse

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Make forms 'Ajaxy' Link to this post

    Mm, I'll give it a try the 'normal way'. Don't run too far as I'll probably be coming back on this one

    I looked into formResponse but it didn't make me a lot wiser... and when I clicked the documentation-link I was presented with an login - box.

    1498 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.