I want to Save to a field in the table but not from any input from the form. I thought something like:-
on a custom code block but it doesn't work. I would like to Save without DBSave just using code. Have you any examples I can look at?
<?php
record[userid] = 9000
?>
on a custom code block but it doesn't work. I would like to Save without DBSave just using code. Have you any examples I can look at?
Hi peterswa62,
Pleas try this in a Custom Code action before the DB Save action
Bob
Pleas try this in a Custom Code action before the DB Save action
<?php
$form->data['userid'] = 9000;
?>
Bob
Still doesn't work.
This is what I get putting the Debugger after Submit:-
Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => CreateUpdateApplicationForm1
[event] => submit
[Itemid] =>
[record] => Array
(
[cf_modified] => 2013-02-08 06:29:30
[cf_modified_by] => 0
[id] => 1
)
[submit1] => Submit
[8199f873544f09199b7710d2fa9ffccb] => 1
[userid] => 9000
[record_id] => 1
)
Validation Errors:
Array
(
)
This is what I get putting the Debugger after Submit:-
Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => CreateUpdateApplicationForm1
[event] => submit
[Itemid] =>
[record] => Array
(
[cf_modified] => 2013-02-08 06:29:30
[cf_modified_by] => 0
[id] => 1
)
[submit1] => Submit
[8199f873544f09199b7710d2fa9ffccb] => 1
[userid] => 9000
[record_id] => 1
)
Validation Errors:
Array
(
)
Hi peterswa62,
As you can see the value is correctly set, but I don't see any sign of the DB Save action is it enabled?
Bob
As you can see the value is correctly set, but I don't see any sign of the DB Save action is it enabled?
Bob
DBSave is there and enabled. Is it to do with the Model and should you prefix the fields with the Model name if you are using it?
I think the reason it doesn't work is because the field is being changed after the form has been submitted and so is not saved to the database. So how do you save without using DBSave?
Hi peterswa62,
Best not to use Model IDs unless you know that you need them. If you do then you have to be consistent to make sure that the data you want to save is correctly saved. I think it needs to be e.g. as $form->data['model_id']['input_name']
You can always use a Custom Code action to hand-code a MySQL query to save your data; there are many examples in the forums here. It's only really needed if you want to save form data to multiple records in the same table.
Bob
Best not to use Model IDs unless you know that you need them. If you do then you have to be consistent to make sure that the data you want to save is correctly saved. I think it needs to be e.g. as $form->data['model_id']['input_name']
You can always use a Custom Code action to hand-code a MySQL query to save your data; there are many examples in the forums here. It's only really needed if you want to save form data to multiple records in the same table.
Bob
This topic is locked and no more replies can be posted.