⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Add custom action button in edit form



shuvo_mahfuz
  • profile picture
  • Member

Posted 18 July 2013 - 07:48 AM

Is there any way to add a custom button in edit form.

 

thanks in advance


davidoster
  • profile picture
  • Member

Posted 19 July 2013 - 07:11 AM

Hello and welcome to the forums [member=shuvo_mahfuz].

If you mean the same way we do by using the add_action unfortunately no there is not.

But you can make tthis button statically by modifing the assets/grocery_crud/themes/your_theme/views edit.php file.

Otherwise you can inspect the getState and on $state == 'edit' inject some js/jq code.


Felipe Matos
  • profile picture
  • Member

Posted 06 January 2014 - 12:51 PM



Hello and welcome to the forums [member=shuvo_mahfuz].

If you mean the same way we do by using the add_action unfortunately no there is not.

But you can make tthis button statically by modifing the assets/grocery_crud/themes/your_theme/views edit.php file.

Otherwise you can inspect the getState and on $state == 'edit' inject some js/jq code.

 

In $state == 'edit' , the string is at the top of the page. 

 

How do I do to pass the $crud->getStateInfo()->primary_key for edit.php or to put this "primary_key" side of the cancel button for example?


ssfthurber
  • profile picture
  • Member

Posted 18 February 2014 - 19:19 PM

you asked about adding custom buttons on an edit form, if i've read correctly. in the edit state, the key is in a URL segment. have the controller use that to build the URL string you need then use your view to inject code for a button into the body. i do this sort of hing s often that my views have more hooks than anything else, and end up having mostly stuff like this:

<?php foreach($css_files as $file): ?><link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" /><?php endforeach; ?>
<?php global $inject_after_cssfiles; echo $inject_after_cssfiles; ?>
<?php global $inject_after_cssinline; echo $inject_after_cssinline; ?>
<?php global $inject_atop_js; echo $inject_atop_js; ?>
<?php foreach($js_files as $file): ?><script src="<?php echo $file; ?>"></script><?php endforeach;?>
<?php global $inject_after_jsfiles; echo $inject_after_jsfiles; ?>
<div id="this_page_body" >
<?php 
global $inject_atop_body; 
echo $inject_atop_body; 
global $extraJS; 
$output.=$extraJS;
echo $output; 
?>
</div>