Forums

On Submit CC+CF Question

augustobotossi 06 Aug, 2009
Dear All,

I installed the newest version of both components (CF and CC).

My question is if the code that I wrote in the On Submit field of my Admin Edit CF form is executed when I either save or post the changes I performed.

To make myself clear, I select a record that appears in the Admin View, a CF form opens so I can make the changes I want. Then, when I press the save button, are the codes written in the On Submit field going to be executed?

I tried this code in both On Submit fields and nothing happened.

<?php
$localdb =& JFactory::getDBO();
$usuario_nome = JRequest::getVar('text_10', '', 'post');
$localdb->setQuery('SELECT cf_user_id FROM #__chronoforms_Form_Pre_Reserva1 WHERE User_Nome="'.$usuario_nome.'"');
$usuario_id = $localdb->loadResult();
$status_pontos = JRequest::getVar('select_35', '', 'post');
$aux1 = JRequest::getVar('text_2', '', 'post');
$localdb->setQuery('SELECT id FROM #__js_res_record WHERE title="'.$aux1.'"');
$aux2 = $localdb->loadResult();
$localdb->setQuery('SELECT field_value FROM #__js_res_record_values WHERE record_id="'.$aux2.'" AND field_id=1');
$pontos = $localdb->loadResult();
if ( $status_pontos == "Voucher" ){
$localquery = "UPDATE `#__comprofiler` SET `cb_pontos` = `cb_pontos`+".$pontos." WHERE `user_id` = ".$usuario_id.";";
$localdb->setQuery($localquery);
$localdb->query();
}
?>

Thks.
GreyHead 06 Aug, 2009
Hi augustobotossi,

The OnSubmit Before box code only executes if Send Emails is set to On on the Form General Tab.

Bob
This topic is locked and no more replies can be posted.