Page 1 of 1

ACTION FOR CHECK LIST OPERATION FAILED

PostPosted: Mon Jul 30, 2012 10:12 pm
by samhans
HAI STEVE AND ALL,

This action is to get the service number from the user and then change SELECTED CHECKBOX loan holder to the loan holder entered in the form.
I have tried to do this by the following action but failed.
My code:

<?php
class actions_loan{
function handle(&$params){

if(isset($_POST['submit'])){

$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$table = &Dataface_Table::loadTable($query['-table']);
$records =& df_get_selected_records($query);
$auth =&Dataface_AuthenticationTool::getInstance();
$user =& $auth ->getLoggedInUser();
$updated = 0; // Count the number of records we update
$errs = array(); // Log the errors we encounter
$service_no = $_POST['serno'];

foreach ($records as $rec){
$role = $user->val('Role');
if ( $role != 'ADMIN') {
$errs[] = Dataface_Error::permissionDenied(
"This type of approval is only for ADMIN'".
$rec->getTitle().
"' cannot be update. Action Denied by web master");
continue;
}
$rec->setValue('loan_holder',$service_no );

$res = $rec->save(true /*secure*/);
if ( PEAR::isError($res) ) $errs[] = $res->getMessage();
else $updated++;

}

}


echo '
<form action="http://111.11.11.11/www/index.php?-action=loan" enctype="application/x-www-form-urlencoded" method="post" >
<b>Enter Service no:</b><input name="serno" type = "number"/>
<input type="reset" name="Reset"/><input type="submit" value="submit" />
</form>';

}
}

THANKS FOR THE HELP

Re: ACTION FOR CHECK LIST OPERATION FAILED

PostPosted: Tue Jul 31, 2012 10:24 am
by shannah
Need more info. What do you mean by failed?

Re: ACTION FOR CHECK LIST OPERATION FAILED

PostPosted: Tue Jul 31, 2012 10:35 am
by samhans
steve failed means after entering the service no when i click on submit , the action must execute and change the loan holder column to the value i entered but nothing seems to be working.

i have echoed the $post value. it showing the entered no. but the action is not changing the loan holder field.