CustomAction using a variable

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
nyukuri
User
Posts: 123

CustomAction using a variable

Post by nyukuri »

Hello,

I have a table where I want to add a CustomAction (ListPage -> Row_CustomAction)
So far I have no problem to set this up. What I want is, to create in another table entries, but with a variable that I need to define every time anew just before running the CustomAction. Simply inserting new rows in another table is also not the problem.

But I am stuck of how to insert this variable.

Lets say today I add data from my selected rows + "XXX" in that other table.
But tomorrow I add data from my selected rows + "YYY" in that other table.
(XXX and YYY are actually to be retrieved from again another table)

So just before (or at the beginning of) running the CustomAction I need to be able to tell if I add XXX, YYY (or something else)

I tried the following solution: I made a Custom Page where the user can select his data (the XXX or YYY) then this page calls my table from where I do the row selection, sending the parameter via URL and retrieve this with $GET.
My CustomAction works - as long as I do not perform a search. Then the table is of course reloaded and loses the variable I had just retrieved before with $
GET. For selecting the right rows, I need to do the advanced search though.

So my problem would be solved, if I could call the table (with the parameter), do then my advanced search BUT WITHOUT losing that parameter, it has to be kept and carried on when the page reloads because of the search.

Is there a way to do just that ? Or any other solution to my problem ?

Thank you very much for any help!


digitalphotoworld
User
Posts: 416
Location: Nürnberg/Germany

Post by digitalphotoworld »

Just use a $GLOBAL var eg. $GLOBAL['my_parameter_for_custom_action'].

Put your code in Page_Load event and retrieve the data from your custom page via $_GET and write this data into the $GLOBAL. Now you could use this $GLOBAL in all other events.


nyukuri
User
Posts: 123

Post by nyukuri »

Thank you,
I just implemented another solution, where I don't need the custom page. I have the selection of the parameter with a form in my Page_DataRendering, this value is then immediately written into a cookie (client side document.cookie) and then in the CustomAction the cookie is read out...
Not very elegant but it works :)


Post Reply