I have a form A with a multi record loader. From there I can load form B where I load all fields. In form B, I am trying to use a field within a php code but can't figure out exactly how to call for it. My model ID in both forms is 'FInsc' and I have the Load Under Model ID option set to No.
I've tried the following:
...and some other I can't remember now, but I can't find the right one. Or maybe is the settings that are wrong?
I've tried the following:
$form->data['adjunto_1']
///////////////////////////////////
$finsc=$form->data['Finsc']; //and then...
$finsc['adjunto_1']
///////////////////////////////////
$form->data['Finsc']['adjunto_1']...and some other I can't remember now, but I can't find the right one. Or maybe is the settings that are wrong?
Hi dmontpe ,
The form data isn't automatically preserved between forms :-(
If you are saving data to the database then you can read it back; or more simply you can use the "Data to Session" and "Session to Data" actions to save the data in the User session and recover it again.
Bob
The form data isn't automatically preserved between forms :-(
If you are saving data to the database then you can read it back; or more simply you can use the "Data to Session" and "Session to Data" actions to save the data in the User session and recover it again.
Bob
Thanks for your reply, Bob. My understanding (which could be completely wrong) is I'm not really talking about carrying data from one form to the other.
Form B has its own record loader action. Form A just helps to add the cf_uid to the url when opening form B so fields can be populated. My guess is that's why I am able to call the same data within html code using {adjunto_1}. Isn't it that for fields to be populated the variables are actually defined? I don't understand why data is available through html but not php.
P.S. Thanks again for your time, Bob. When my project gets done, I'll make sure to send a couple beers down your way.
Form B has its own record loader action. Form A just helps to add the cf_uid to the url when opening form B so fields can be populated. My guess is that's why I am able to call the same data within html code using {adjunto_1}. Isn't it that for fields to be populated the variables are actually defined? I don't understand why data is available through html but not php.
P.S. Thanks again for your time, Bob. When my project gets done, I'll make sure to send a couple beers down your way.
Hi dmontpe ,
I'm lost ?-( I don't know where adjunto_1 is coming from if it isn't form data?
Bob
I'm lost ?-( I don't know where adjunto_1 is coming from if it isn't form data?
Bob
Well, I don't know where the data is coming from but it sure is there as the links they're part of work.
I would like to understand how this works anyway. So, my reasoning was wrong and $form->data['adjunto_1'] won't be actually defined until the form is submitted, right? Then basically the record loader action just fills in the fields "manually", so to speak, without defining any variables, right?
I would like to understand how this works anyway. So, my reasoning was wrong and $form->data['adjunto_1'] won't be actually defined until the form is submitted, right? Then basically the record loader action just fills in the fields "manually", so to speak, without defining any variables, right?
Hi dmontpe,
That's correct; $form->data only exists after the form is submitted.
For the DB Load, ChronoForms reads the record from the table, then parses the Form HTML looking for inputs (if 'edit' is enabled) or {input_name} placeholders and adding the appropriate values from the record.
Bob
That's correct; $form->data only exists after the form is submitted.
For the DB Load, ChronoForms reads the record from the table, then parses the Form HTML looking for inputs (if 'edit' is enabled) or {input_name} placeholders and adding the appropriate values from the record.
Bob
Hi, Bob.
I've looking around for the thing I need and have a couple questions:
1. How do I use the data passed on via session to data? Can I use it with PHP? I tried the $form->data array and got nothing, so I'm wondering.
2. I found this code you suggested to somebody else that can retrieve data from the url used to call the page. I tried it but it just messes the whole page and produces no results:
The echo part was just for testing, what I really want is to be able to use it to query the database or search for all files starting with the contents of a certain db field. Any ideas why it's not working?
David
I've looking around for the thing I need and have a couple questions:
1. How do I use the data passed on via session to data? Can I use it with PHP? I tried the $form->data array and got nothing, so I'm wondering.
2. I found this code you suggested to somebody else that can retrieve data from the url used to call the page. I tried it but it just messes the whole page and produces no results:
<?php
if ( !$mainframe->isSite()) {return;}
$token = JRequest::getVar("token", "", "get");
echo $token;
?>The echo part was just for testing, what I really want is to be able to use it to query the database or search for all files starting with the contents of a certain db field. Any ideas why it's not working?
David
Hi David,
Q1 I don't understand. You can do pretty much anything with any data. I had a little dig in the code and the retrieved session data is merged into the $form->data array.
Q2 This line is a hangover from CFv3.1 and may be causing an error in CFv4 - you can delete it.
Bob
Q1 I don't understand. You can do pretty much anything with any data. I had a little dig in the code and the retrieved session data is merged into the $form->data array.
Q2 This line is a hangover from CFv3.1 and may be causing an error in CFv4 - you can delete it.
if ( !$mainframe->isSite()) {return;}Bob
Thanks, again, Bob. I got it to work with the answer to Q2. It works perfectly now. What I wanted to accomplish was to show all uploaded files from a certain person. Since uploaded files are named with the person's id in front, once I got that from the db using cf_uid as reference, I was able to find all corresponding files using the glob function. (I am just writing all this in case somebody else can find it useful)
This topic is locked and no more replies can be posted.
