Forums

Updating a field via custom code

rcadmin 22 Oct, 2014
I have a hidden field called "paymentdue".

Under setup, submit, I have the following custom code
<?php
  $paymentdue = 115;
  if ($form->data['skillsessions'] == 'Yes') $paymentdue=$paymentdue + 45; 
  $form->data['paymentdue'] = $paymentdue;
?>


When I submit the form, the debug info shows that "paymentdue" has the correct value.

After the custom code I then call the DB Save action.

The problem I have is that this field is not saved to the database

Some debug info is below:

Array
(
    [option] => com_chronoforms5
    [chronoform] => Basketball_Enrollment_7to8
    [event] => submit
    [studentname] => Fred
    [studentsurname] => Smith
    [address] => 1243  Nowhere
    [suburb] => There
    [postalcode] => 02443
    [dob] => 27-10-2014
    [schoolyear] => Year 8
    [playedbefore] => No
    [experiencelevel] => No experience
    [team] => 
    [league] => 
    [parentname] => Andre
    [parentemail] => email@school.nz
    [parenthomephone] => 021 1234 432
    [parentmobile] => 13 23 23
    [vday] => 
    [time] => 
    [understandconditions] => 1
    [permission] => 1
    [skillsessions] => Yes
    [registration] => 1
    [paymentdue] => 160
    [paymentmethod] => Cash
    [button50] => Submit
    [719430a5484b618542b562bbae65f4c77d4f4ed5] => 1
    [id] => 22
)


Array
(
    [10] => Array
        (
            [Check Honeypot] => Array
                (
                    [0] => Honeypot check passed.
                )

        )

    [14] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => INSERT INTO `jexp_chronoengine_CF_Basketball_Enrollment_7to8` (`studentname`, `studentsurname`, `address`, `suburb`, `postalcode`, `dob`, `schoolyear`, `playedbefore`, `experiencelevel`, `team`, `league`, `parentname`, `parentemail`, `parenthomephone`, `parentmobile`, `vday`, `time`, `understandconditions`, `permission`, `skillsessions`, `registration`, `paymentmethod`, `user_id`, `created`) values ('Fred', 'Smith', '1243  Nowhere', 'There', '02443', '27-10-2014', 'Year 8', 'No', 'No experience', '', '', 'Andre', 'email@school.nz', '021 1234 432', '13 23 23', '', '', '1', '1', 'Yes', '1', 'Cash', '0', '2014-10-22 13:52:35');
                        )

                )

        )

)


The database does have a "paymentdue" field
Max_admin 23 Oct, 2014
Answer
Hi rcadmin,

If you have added this field to the database table after creating it then please click the "Delete cache" button in the forms manager, since Chronoforms keeps a cache of tables fields for 24 hours!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rcadmin 23 Oct, 2014
That was it ... thanks :-)
This topic is locked and no more replies can be posted.