argument between JS and php on php list plugin ?

lcollong

FabriKant d'applications web
Hi,

On a list view, I need to display a window to let the user select the right day (calendar) and time (dropdown) as well as place (dropdown) to be use in a process involving all the rows he has selected.

All the rows will use the same informations catched only once before actually process the rows.

I can't use update list plugin as the process involved is more than updating rows and the way the window shows the field to be set by the user is really unfriendly.

My first idea would be to use the js part of the php list plugin to build a JS popup to allow the user to select/enter his choice before triggering the actual php code on the server. But how can I pass back the js variable to the php script eval'd or included in the plugin ?

Second idea would to use the js list plugin to build the popup, get the user choices and trigger an ajax call with the user choices in the url parameter. But my list in not ajaxified. May I still use this process ?

Is there another way to let the user select several rows from the displayed list, show up a popup to enter values in 3 different fields and pass them back to a php script which will actually process the data on each row and finally display back the list ?

Thanks
 
The only way I can think of to do that would be to inject hidden elements into the list's form.

Code:
var list = Fabrik.getBlock('list_X');
jQuery('<input>',{
   type:"hidden",
   name:"foobar",
   id:"foobar",
   value:"123"
}).appendTo(list.form);

Obviously replace stuff to suit, so X is numeric ID of list, replace foobar with whatever you want, and "123" with your variable. Do the jQuery(...).appendTo() as many times as you need.

That element should then get submitted with the list'd form on the plugin submit, and should then be available on the PHP side in the usual input array.

Code:
$foobar = $this->app->input->get('foobar', '');

I haven't tried this, but it's a technique we use a in several places, so it should work.

Just be sure to use unique names that aren't likely to tread on anything we use.

-- hugh
 
It works perfectly. Thanks.
However, since I need to catch a date (date picker) and 3 dropdowns (hour, minute and place), I think it might be more efficient to open a fabrik form in a popup to let the user enter these data with an onAfterProcess php script on submit to actually do the job on the selected rows (ajax ?) and come back to the JS to trigger a list update at the final step.
I know how to pass the selected ids to the js calling the form, I know how to pass the user choices to the php ajax script though the url's params but what would be the best way to link these two steps ? ie "inform" the form of the list of selected ids and keep them to append the list as one of the parameter of the ajax url at submit time ?
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top