I have a form with a select box with items x, y, z, where x is the standard ... I wonder if there is a possibility to record modification date in a column at db when y is selected and record modification date in another column if Z is selected.
Sorry English by google translator
Sorry English by google translator
Hi felipeb.soares,
You can add custom code to change the modification date input name after the form is submitted.
Bob
You can add custom code to change the modification date input name after the form is submitted.
<?php
switch ( $form->data['xxx'] ) {
case 'x': ) {
$form->data['column_a'] = date('Y-m-d');
break;
case 'y': ) {
$form->data['column_b'] = date('Y-m-d');
break;
case 'z': ) {
$form->data['column_c'] = date('Y-m-d');
break;
}
?>
Bob
<?php
switch ( $form->data['Andamento'] ) {
case 'Contrato em elaboração': ) {
$form->data['Contratoemelaboração'] = date('Y-m-d');
break;
case 'Cancelado': ) {
$form->data['Cancelado'] = date('Y-m-d');
break;
}
?>
Bob, the code did not work, or I did something wrong.
Do I need to create a hidden field or just being duly appointed to the columns in the database?
The where exactly should I put custom code?
Sorry, it's complicated search in English for those responses in the forum.
Hi felipeb.soares,
Please don't use 'special' characters in input names, and best not in option values either. Use letters a-z, numbers and '_' only.
So. for example, replace 'Contrato em elaboração' with 'Contrato em elaboecao' in the option value (the text can stay as it is) and 'Contratoemelaboração' with 'contrato_em_elaboracao' in the input name.
The code needs to go into a Custom Code action in the form On Submit event.
Bob
Please don't use 'special' characters in input names, and best not in option values either. Use letters a-z, numbers and '_' only.
So. for example, replace 'Contrato em elaboração' with 'Contrato em elaboecao' in the option value (the text can stay as it is) and 'Contratoemelaboração' with 'contrato_em_elaboracao' in the input name.
The code needs to go into a Custom Code action in the form On Submit event.
Bob
Now it is writing NULL, no date.
Hi felipeb.soares,
Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.
Note: if you are using the Easy Wizard you may need to switch to the Advanced Wizard to do this; if you want to continue to use the Easy Wizard please make a copy of your form first and add the Debugger action to the copy.
Bob
Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.
Note: if you are using the Easy Wizard you may need to switch to the Advanced Wizard to do this; if you want to continue to use the Easy Wizard please make a copy of your form first and add the Debugger action to the copy.
Bob
This topic is locked and no more replies can be posted.