Add a button in edit form

60 views
Skip to first unread message

josevalviana

unread,
Dec 18, 2012, 2:31:31 PM12/18/12
to joomla-de...@googlegroups.com
I want to add a button in my component's edit form so when clicked it updates something in database, p.ex.:

This button with this caption <finish> when clicked should update three fields in database:

field 1: finished (0/1) => 0 = no; 1 = yes.
field 2: who_finished => which will save the user who clicked the button.
field 3: date_finished => which will save the datetime the user clicked the button.

any tips?

In com_banners we have something alike... but only updates the field itself...

Glenn Arkell

unread,
Dec 18, 2012, 3:12:24 PM12/18/12
to joomla-de...@googlegroups.com
Hi Josevalviana,

I did one of these yesterday and found the hint in the doco (http://docs.joomla.org/Creating_a_toolbar_for_your_component).  In particular the comments to the right.  Create a task/function in your controller which will call a method in your model to do whatever updates you want.  If you want a new button, create the custom JToolBarHelper in your view to action the controller task or you can overload an existing button.  Cheers.

josevalviana

unread,
Dec 19, 2012, 12:22:52 PM12/19/12
to joomla-de...@googlegroups.com
Thanks for your reply.. 

I'll definitely give it a try... suppose I don't want it in the toolbar but an input button in the form... Is there any other custom helper like JToolbarHelper to do that job?

Glenn Arkell

unread,
Dec 19, 2012, 4:41:52 PM12/19/12
to joomla-de...@googlegroups.com
After responding to your question I thought I might as well add an example to the document I referred to with an example so I hope it helps.  As for placing the button in the edit form itself, sure why not... you are only limited in your imagination as to what you can do with Joomla! now-a-days.  Hope it helps anyway.  Cheers.
Reply all
Reply to author
Forward
0 new messages