Forums

DB Record Loader - manage data loaded with PHP code

sfigattomambo 13 Mar, 2013
Hi to all,
I'm using DB Record loader feature to load DB fields in order to perform ad EDIT action on record submitted previously with an INSERT form.
I need to manage the loaded record also through PHP code.
In my EDIT view form I use the sintax:
<input type="text" value="{db_column_name}">
and all goes well.

When I use the sintax
<?php
echo "test:". $form->data['db_column_name'];
?>
nothing happen.

Any ideas?

Thanks
GreyHead 13 Mar, 2013
Hi sfigattomambo,

Where exactly do you have this code? And what is the code you are testing?

I would probably do the data 'massaging' in a Custom Code action and add the results into the $form->data[] array as, for example $form->data['db_column_name_modified']

Then you can use {db_column_name_modified} in a Custom Element element to display the result.

Bob
sfigattomambo 14 Mar, 2013
Hi Bob,
many thanks for your answer.
I'm trying to use the code:
<?php
echo "test:". $form->data['db_column_name'];
?>

in my form frontend code (the code loaded through Show Html feature).
I want to catch some values saved into DB in order to show or hide some dedicated input fields.

Thanks
Luca
GreyHead 14 Mar, 2013
Hi sfigattomambo,

Use a Debugger action in the On Load event to see exactly what values are in the $form->data array. If you are using a Model ID in the DB Record Loader the data will be in a sub-array.

Bob
sfigattomambo 19 Mar, 2013
Hi Bob,
what I was looking for is for data loaded in $data['xxx'] array.
Using the $data['myVar'] and $_POST['mySubmittedField'] arrays I solved my problem.

Many thanks
Luca
This topic is locked and no more replies can be posted.