retrieve value upload form

Permalink
Hy.

I'm creating a new custom block upload (see screenshot).

I would like to send email notification to users when I upload a file.

I have a problem. How can I retrieve value of checkboxes?

add.php
*********************************************
<?php  
defined('C5_EXECUTE') or die(_("Access Denied."));
$includeAssetLibrary = true;
$al = Loader::helper('concrete/asset_library');
Loader::model('user');
$user = new user();
$uID=$user->getUserID();
function getListUsers($uID)
{
   $db = Loader::db();
  $g = $db->Execute("SELECT uID,uName FROM Users WHERE uID <> '$uID' ");
  while ($grow = $g->fetchrow())
   {


Please help me.

Thank you very much!

1 Attachment

 
olliephillips replied on at Permalink Best Answer Reply
olliephillips
Your add.php can contain this:-

<?php echo $form->checkbox('mycheckboxfield',1,1);?>


You need to use the save method in your controller, pass the saved fields into that method via argument, do something like the below, remembering to pass the saved fields to the parent save method.

function save($args){
$args['mycheckboxfield'] = isset($args['mycheckboxfield']) ? 1 : 0;
parent::save($args);
}


In your edit.php file you can set the field from the stored database value using the below:-

<?php echo $form->checkbox('mycheckboxfield',1, $mycheckboxfield);?>


Hope that helps.
jlbbooks replied on at Permalink Reply
Perfect! I solve my problem.

Thank you very much!