22847 Posts in 9642 Topics by 2802 members
|Go to End|
7 November 2012 at 2:01am
I'm using SilverStripe 2.4.7 and I followed this tutorial. It worked brilliantly but the next thing I want to do is pass some parameters into the doAction method. I'm having trouble finding any info on how this could be done. Sorry if this is a really obvious question. I'm stumped though. I assume I'll need to include and extra argument in
$Action = new FormAction(
"Do something different"
I'd appreciate any guidance.
7 November 2012 at 2:07am Last edited: 7 November 2012 2:07am
What kind of parameter would you need to pass?
As an alternative I use what I call "onAfterWrite hack" (matches with "adding-a-cms-action-the-slightly-hacky-way")
put a check box on the DataObject, in the onAfterWrte determine if that is checked if it is do some action and then set it to unchecked and call write again. yes... hacky, hacky, hack-hack but it only wastes CPU/disk when saving and performing the your "action" and you can add anything you like to the DataObject or directly to the form that will be passed in for use with your "action"
7 November 2012 at 2:44am
Thanks for your reply. I had considered the onAfterWrite method but don't actually want to write anything.
I'll give you some background to help explain. Basically, I am integrating urbanairship and I have it sending out push notifications with hard coded data but I want the user to be able to insert a message into a textfield and that to be sent to the Urban Airship method.
7 November 2012 at 3:58pm
Ok well the onAfterWrite hack seems fine to me for your purpose - much more work to put get it into a form action (that it is not designed for) so I can help no further - best of luck
7 November 2012 at 9:52pm
Your advice is much appreciated. Thanks.
|Go to Top|