Hi,
I'm trying to do something very simple:
A form is accessed using the correct URL with a parameter added to it like
When the form loads, it runs a Read Data object and returns the First matching record where the ID = the gcb value (123456).
The Read Data action works as expected. It's behaviours are set as 'External Database', 'Where Statement' (fieldidname = {data:gcb}) and 'Data Merge'.
I am debugging the form and can see that the read data has worked as expected. And, because I set the Data Merge, I can see that the data is available in the Data section of the debugger:
I can also see that the retrieved data is shown in the Vars section of the debugger:
This is great!
All I need to do is take the value of 'anotherfield' and get it to populate in the form field.
Apart from it doesn't work!!?? If I create a text field and set the name to anotherfield the value is not pulled from the read data action. If I set the field name to gcb, the value is pulled through. I've tried all types of options to get this simple Read Data and populate the fields to work, none of them without any success.
Does anyone have any ideas?
Thanks in advance, Paddy
I'm trying to do something very simple:
A form is accessed using the correct URL with a parameter added to it like
&gcb=123456
When the form loads, it runs a Read Data object and returns the First matching record where the ID = the gcb value (123456).
The Read Data action works as expected. It's behaviours are set as 'External Database', 'Where Statement' (fieldidname = {data:gcb}) and 'Data Merge'.
I am debugging the form and can see that the read data has worked as expected. And, because I set the Data Merge, I can see that the data is available in the Data section of the debugger:
Array
(
[option] => com_chronoforms8
[chronoform] => form-name-here
[gcb] => 123456
[fieldidname] => 123456
[anotherfield] => Some Text Here
....
)
I can also see that the retrieved data is shown in the Vars section of the debugger:
Array
(
[app_active_page] => 0
[readdataname] => Array
(
[fieldidname] => 123456
[anotherfield] => Some Text Here
...
)
)
This is great!
All I need to do is take the value of 'anotherfield' and get it to populate in the form field.
Apart from it doesn't work!!?? If I create a text field and set the name to anotherfield the value is not pulled from the read data action. If I set the field name to gcb, the value is pulled through. I've tried all types of options to get this simple Read Data and populate the fields to work, none of them without any success.
Does anyone have any ideas?
Thanks in advance, Paddy
OK, I thought I would update this with the issue and resolution...
My forms are quite complicated and I didn;t want to write a long and lengthy post which included the complexities of the form.
I need to validate that someone has access to the form before it loads any data. I therefore had a PHP action (within the 'On Record(s) Found' section) that did the validation and returned either 'success' or 'fail' as a value. There were then two events called 'success' and 'fail' and I was putting the fields to be displayed in the 'success' event.
This was not working!
As soon as I moved the fields outside of both the 'PHP' action and 'Read Data' action, the data was displayed.
I now just need to know how to stop the remainder of the form loading if the PHP validation fails. But my original issue is now resolved...
Thanks, Paddy
My forms are quite complicated and I didn;t want to write a long and lengthy post which included the complexities of the form.
I need to validate that someone has access to the form before it loads any data. I therefore had a PHP action (within the 'On Record(s) Found' section) that did the validation and returned either 'success' or 'fail' as a value. There were then two events called 'success' and 'fail' and I was putting the fields to be displayed in the 'success' event.
This was not working!
As soon as I moved the fields outside of both the 'PHP' action and 'Read Data' action, the data was displayed.
I now just need to know how to stop the remainder of the form loading if the PHP validation fails. But my original issue is now resolved...
Thanks, Paddy
in the fail event of the PHP add a redirect action to a login page
you may also keep everything inside the "success" event
you may also keep everything inside the "success" event
You need to login to be able to post a reply.