execute action from action php code

teldrive 26 May, 2014
I need advice to user that is going to delete a record
so i change button delete action
$this->view->Toolbar->addButton("toolbar-button-remove","http://seden.es/es/component/chronoconnectivity5/?cont=lists&ccname=gestion_papers_list&act=borrar", "BORRAR", "http://congresoseden14.es/libraries/cegcore/assets/images/toolbar/remove.png", "submit_selectors"); 

and create a new action "borrar" with following php code
<?php
print "<script type=\"text/javascript\">"; 
print "alert('Are you sure?')"; 
print "</script>";  
?>

the issue is how can i call again to default "delete" action and pass "submit_selectors" parameters?
calculus00 26 May, 2014
Hello teldrive,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
What is the Custom Code action?
P.S: I'm just an automated service😉
teldrive 26 May, 2014
Thanks Calculus but in this case is a little more tricky, because is a CC issue,
the question is if I use a custom-delete-CC-function("borrar") that advice to user before delete records, so far is working only the advice, implemented with php+script, the issue is how can i call to default-delete-CC action and if submit_selectors are passed easily between actions
Max_admin 27 May, 2014
Hi Teldrive,

Just replace "submit_selectors" by "your_function_name" and add the function to the page.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 27 May, 2014
Hi Max thank by reply
let me tell you what i have tried so far without results, i started with a simple message
function borrar_function() 
 {  
 print "<script type=\"text/javascript\">"; 
 print "alert('Are you sure?')"; 
 print "</script>"; 
 } 
$this->view->Toolbar->addButton("toolbar-button-remove","http://midomain/component/chronoconnectivity5/?cont=lists&ccname=gestion_papers_list&act=delete", "BORRAR", "http://midomain/libraries/cegcore/assets/images/toolbar/remove.png", "borrar_function()"); 
i tried also with borrar_function and borrar_function(); but it doesn't work
another doubt arise is it posible to call "submit_selectors" from my custom function?
function borrar_function() 
 {  
 print "<script type=\"text/javascript\">"; 
 print "alert('Are you sure?')"; 
 print "</script>"; 
submit_selectors();
 } 
Max_admin 27 May, 2014
Please try to use the "confirm" function instead of "alert":


function borrar_function() 
 {  
var r=confirm("Are you sure ?");
if(r == true){
$("#admin_form").submit();
}
 } 
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 27 May, 2014
Hi Max , there are some advances,😉 after some testing i discovered that borrar_function has to be a JavaScript function so i set escape code in order to get correct performing, Now popup window appear, but after accept nothing goes, the issue remaining is the funcion to delete submit_selectors => $("#admin_form").submit(); i am not sure if is it php(I tried con escape php codes , also with http://midomain/component/chronoconnectivity5/?cont=lists&ccname=gestion_papers_list&act=delete but failed) or do I missing something
<script type="text/javascript">
function borrar_function() 
  {  
 var r=confirm("Are you sure ?");
 if(r == true){
 $("#admin_form").submit();
 }
  } 
</script>
<?php
$this->view->Toolbar->addButton("toolbar-button-remove","http://midomain/component/chronoconnectivity5/?cont=lists&ccname=gestion_papers_list&act=delete", "BORRAR", "http://midomain/libraries/cegcore/assets/images/toolbar/remove.png", "borrar_function"); 
Max_admin 28 May, 2014
Hi Teldrive,

Yes, its JavaScript, I think that your implementation now is correct, what's the current problem ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 28 May, 2014
Hi Max, the remaining issue is when "accept" is pressed
 $("#admin_form").submit();

seems to do nothing, what I need to do is to delete the records of "submited_selectors"
Max_admin 30 May, 2014
Please try
jQuery("#admin_form").submit();
?
That line of code should submit the form, does the form submit (or the page refreshes) or not ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 31 May, 2014
Answer
:D Thanks Max
it works perfect
<script type="text/javascript">
function borrar_function() 
  {  
 var r=confirm("Are you sure ?");
 if(r == true){
jQuery("#admin_form").submit();
 }
  } 
</script>
<?php
$this->view->Toolbar->addButton("toolbar-button-remove","http://midomain/component/chronoconnectivity5/?cont=lists&ccname=gestion_papers_list&act=delete", "BORRAR", "http://midomain/libraries/cegcore/assets/images/toolbar/remove.png", "borrar_function"); 
teldrive 19 Mar, 2015
Hi Max
One question about this topic, is it possible to do the same override on this placeholder? How can i do?
_DELETE_: for a delete link
Max_admin 20 Mar, 2015
Hi Teldrive,

No, not possible, if you want to run a custom function then you must use the PHP version, you can replace "addButton" by "renderButton" in order to display the button directly.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger