Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » _GET variables and basic actions

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: 2398 Views
  • Nicolaas
    Avatar
    Forum Moderator
    213 Posts

    _GET variables and basic actions Link to this post

    Hi Folk

    I would like to present my user with a list of items and the option to delete one of them. I can make the list with <a href="myurl/?delete=ID">delete this one</a>. However, how do I setup a function that recognises the get variable so that the item can be deleted.

    After that, should I do something like Director::loadSelf()?

    What is best practice for dealing with Get variables (as described above)?

    Also, is there some built-in Ajax functionality that I could use? OPTIONAL EXTRA

    Thanks a million

    Nicolaas

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: _GET variables and basic actions Link to this post

    there are formfields which provide a UI for listing/deleting subclasses of DataObject or Page (with ajax-goodness, pagination, ...):
    http://doc.silverstripe.com/doku.php?id=tablelistfield

    > What is best practice for dealing with Get variables (as described above)?
    Controller→requestParams - please make sure you properly escape GET/POST (http://doc.silverstripe.com/doku.php?id=secure-development)

    alternatively, you can use "urlParams" for this: Director::urlParams(), Controller→urlParams
    by default, each url is built like this: controller/action/ID/OtherID
    (where each of the parts is an associative index in the urlParams-array)

  • Nicolaas
    Avatar
    Forum Moderator
    213 Posts

    Re: _GET variables and basic actions Link to this post

    Thanks Ingo!

    2398 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.