Load a form in List PHP script ?

Incremental

Member
Hi,
how is it possible to load a form in a PHP List script ?

I would like to have a button calling the regular Form associated to the List (Edit)
... and I would like to have another button calling another Form having a specific Form script

==> how to call this other form with my {rowid} ?

Thanks
 
what precisly do you mean by "calling a form" - do you mean redirecting the browser to a page which loads the form? I'm presuming that's the case.
So you can get the row ids as defined in the wiki:

http://fabrikar.com/forums/index.php?wiki/php-list-plugin

Its going to be an array - as mutliple rows can be selected - not sure how you would want to deal with that, perhaps just pick the first value, so something along these lines might work:

PHP:
$app = JFactory::getApplication();
$ids = $app->input->get('ids', array(), 'array');
$id = array_shift($ids);
$app->redirect('index.php?option=com_fabrik&view=form&formid=X&rowid=' . $id);
 
Well I tried, but I have a never ending loading spinner over the list !

I tried the URL with a fixed and good ID. It works in the browser.
But not from my PHP plugin.
I tried to set Ajaxify links to Yes or No, it's the same.

With Firebug, I see an error in mootools-core.js (line 172, col 1)
SyntaxError: syntax error
(<!DOCTYPE html>

Is something required after $app->redirect() ?

Thanks for your help.
Regards.
 
I confirm that it works fine in a 'full page' Form.
As I'm calling my form from a List Button, I would like to have the same behavior in a Ajax popup window form.
I'm stuck on this point and would really appreciate if it could work.
Thanks for help
 
I'm still not entirely clear what you are trying to do.

Are you trying to load a form in a popup window? So it works like the regular edit button, in AJAX mode, but for a different form?

-- hugh
 
YES !
I have a Contact List where I can view/edit original messages with Contact Form with the regular Edit button.
I cloned the 'Contact' List in 'Contact Reply' to have a different Form showing an answer element.
Working only with the Contact List, I would like :
  • to view original messages clicking on the View button of the List (loading 'Contact' Form)
  • to reply to the message, loading the 'Contact Reply' Form with a PHP list button.
It works when Ajaxify=NO, but I would like to load forms in AJAX popup windows.
I have the pb described in the 4th post.
Thanks for your help.
 
Hmmm. I don't think you could do this with a PHP button, but you might be able to fake it out using a calc element. So try this.

Create a calc element.
Set it to Hidden, so it doesn't show in your forms.
Set "Calc on Save Only" to "No".
Set the "Calculation" to:

PHP:
return '
<a title="Edit" href="/joomla30/index.php/bands/form/17/{rowid}?tmpl=component" data-list="list_17_com_fabrik_17" class="btn fabrik_edit fabrik__rowlink" data-loadmethod="xhr"><i class="icon-edit "></i> <span class="hidden">Edit</span></a>
';

You'll need to replace the href URL with whatever the URL of your target form is, but keep that {rowid} placeholder for the row id. You'll also need to change that data-list reference to whatever your list is, you can look at the source of your list, at the existing Edit links, to see what to use there.

That seems to work for me in a quick test.

-- hugh
 
Note that you'll end up with that link text in the table, as element data. Which doesn't hurt anything, you can just ignore it. But if you really don't want that, you could clone a custom template, and insert your own column and that custom link in the template, rather than using a calc element.

But if this calc hack works for you, and you can just ignore that extra column with junk data in your table, Id go with this solution, so you don't have to maintain a custom template.

-- hugh
 
Thanks for your answer, I have to test it.

I need an advice :
1) I discovered that I can condition the display of elements in a form, based on the content of another element (ie : status) so I could have only one Form with 2 appearances (public / admin) with required ACL settings for elements.
Is there a way to avoid to clone my 'Contact' List in a 'Contact Reply' List if I just need a copy of the 'Contact' Form in a new one, with a different validation script ?

2) could I template my List to add to edit/view/delete buttons, a 'Reply' HTML button with the link you told me ? (avoid to have a column) ?
How to ?

Thanks
 
hi -

Is there a way to avoid to clone my 'Contact' List in a 'Contact Reply' List if I just need a copy of the 'Contact' Form in a new one, with a different validation script ?
The list needs to be cloned along with the form

could I template my List to add to edit/view/delete buttons, a 'Reply' HTML button with the link you told me ? (avoid to have a column) ?
You could use a JS List plugin - that will add a button to each row allowing you to call some JS code e.g. :

JavaScript:
Fabrik.getWindow({id:'uniqueid', 'loadMethod': 'iframe', 'contentURL':'http://fabrikar.com', 'title': 'window title'});

see here for futher info
http://fabrikar.com/forums/index.php?wiki/javascript-window-class/&noRedirect=1
 
Rob,
the JS List plugin seems to work, with the following code :
Code:
Fabrik.getWindow({id:'uniqueid', 'loadMethod': 'iframe', 'contentURL':'http://localhost/J31_F31/index.php/fabrik/reply?tmpl=component', 'title': 'window title'});
Capture.PNG

BUT I have the following problems :
1) it's always the first record which is displayed
2) when I use ?tmpl=component (to avoid a Joomla site in the window) it opens the window like I want, but with a red message bar empty,
Firebug shows the following error :
Capture.PNG
Thanks for your help, I'm near my goal....
 
I hadn't realised you wanted to load a fabrik form, so try this then:

Code:
var url = 'http://localhost/J31_F31/index.php/fabrik/reply?tmpl=component&rowid=' + ids[0] ;
Fabrik.getWindow({id:'uniqueid', 'loadMethod': 'xhr', 'contentURL':url, 'title': 'window title'});
 
Thanks a lot Rob,
I now edit the good record.
BUT not in a popup window, only in a full page. Therefore the 'window title' has no effect.
Any idea ?
 
Friendly bump ;)
Rob, as most of my problems are with popup windows, should I definitely avoid to use 'Full page' Forms ?
... or this could be solved ?
Popup windows are ergonomic and convenient to facilitate navigation !
Thanks
 
which page is this on, sounds like a js error but I'd like to see the page to confirm that

-Rob
 
I tried your code in the 14th post in my JS List plugin.
I develop in local with Uwamp.
Would you need a copy of the site (Akeeba ?). If yes I could provide you a link for the download (33Mo)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top