I try to do something that sound very simple reading faq and forum, but for sure it miss me something to success.
I have a database table containing travels list with ID, code, destination, startdate, enddate and so on.
I retrieve data by an action read_data giving read_data19
I populate a dropdown with list of destinations (this work).
Now the visitor need to select a destination, it should trigger the field "code" by a reload, I need to display informations.
For the moment I try only with the code but it doesn't work. I tried lot of possibilities, but for sure not the right one.
In fact, the question is probably, what should be in the field "value" of the field "code" ?
Thank's for your help.
(cannot upload images, here they are)
https://drive.google.com/open?id=19rCK5nK6FeWUMx-cjLbcKaJFDcqr9ObL
https://drive.google.com/open?id=18-pOIX_BDG8wY9cB2Ln6KuWNqfLlGoYU
https://drive.google.com/open?id=11maqf7BR3J8yh9_9C8ECrPO4WrOZZc-8
Is there a particular reason you want to put a value in the text field, which the user can then change, instead of just using the voyage code and sending reading the correct entry from the database on submit?
It is "return an array..." but specifying 2 fields doesn't change anything.
I want to display details to the subscriber.
Anyway I need to get the code to send it by mail and based on the same mecanism I will also need to send firstname/lastname of subscribers ID of participants (not the connected profile).
https://drive.google.com/open?id=1CJMVLJ8ICE2r-p0dMvrv52y1250XEdoF
The problem is not the trigger, but how to define the field code to get the code value and when I get the code how to select the other value.
You need to read the database based on the field that's triggering the reload, with the data read set to first matching.
but I'am stuck at point 3, where is the add event function ?
https://www.chronoengine.com/forums/posts/t105344/fill-text-from-a-dropdown-db-read
I try to understand and adapt. Not so easy
First step, I want to retrieve the code depending of the destination selected in the dropdown. Later I will see for others informations.
this I did :
Result : something happen when I select a destination in the dropdown, title goes grey color and a grey circle turn but no code value in the field.
You have a dropdown, let's call it "selected_destination".
Under "events", you want On: change, Actions: reload, Identifier: code
I will assume you already correctly set up the read data actions in your load event to dynamically populate the dropdown (yes it is, I display destination).
[color=rgb(255, 0, 0)][mark]Options : = (line to get an empty line first)
{var:read_data19}
read_data19 : Return an array...
Model name : Liste
Fields to retrieve
code
destination[/mark][/color]
You have a text field, let's call it "code".
Under "advanced", you want Reload event: reload_code
You have a database table called xx_my_data, with three fields: id, name, flavour =>>> id, destination, code.
Under the "Setup" tab at the bottom of the page, create a new event called "reload_code".
in fact I was stucked here because with "New V6.1 mode" you add a Page, not an event. I have looked in old Form they are in "V6 classic mode" and have "add en event"
and it seems there is no way to change it throw front end, so I modified it in the sql table. Seems to work
You then want a Read Data action, with your table selected, and call the model "Destination".
* Where conditions: Destination.id:{data:selected_destination}
* Fields to retrieve: Destination.code [br]* Select type: first matching record[br]I have added a "Rule list" in Where conditions[br]Then you need a PHP action (under "Logic"). Replace "action_name" with the name of the read data action, the text in the black Name box. It should probably be "read_data20" or something along those lines.[br]$this->data("code", $this->get("read_data20.Destination.code", ""), true);[br][br]Lastly, you need a Custom code action, with:[br]{view:field_text58} where text_field_view_name is the Name: in the black label of the field.
in fact I was stucked here because with "New V6.1 mode" you add a Page, not an event. I have looked in old Form they are in "V6 classic mode" and have "add en event"and it seems there is no way to change it throw front end, so I modified it in the sql table. Seems to work
In the new builder, you should add a page and set it to STANDALONE and make sure that Auto Display View is switched off.
then you need a PHP action (under "Logic"). Replace "action_name" with the name of the read data action, the text in the black Name box. It should probably be "read_data20" or something along those lines.
This probably doesn't apply to your situation.
This probably doesn't apply to your situation.
Why do you say that, the exemple sound exactly my need ?
I put a debugger in the reload_code event and nothing happen. Seems like it is not triggered
Best way to see if something is wrong is images
https://drive.google.com/open?id=1GDBGrSyEZ0fbyDMWocv2HSuUjsWeeIRz
Thank's for your patience ;-)
first I have corrected the filter in the read_data20 action because it was "code = {data:selected_destination}". ok seeing with debugger that it was getting the right value
I tried {view:field_text58} to {view:field_text62}
but it write the first in the field_text and the other just under. field_text59 to 62 stay empty.
So I did 5 events (like reload_code but returning next field), each one for a field.
OK it work but it is low speed, 5 events is not performance oriented.
Last thing, I say it work, but only by "Preview", when executing by the front end I have grey running circle
Preview : https://drive.google.com/open?id=1dLs5QgKTWCBWfOQIJs4JKVhsM17f2SDE
Running : https://drive.google.com/open?id=1LqUUtTXP2s2FfWIPVj8jxyzHy22Q0kGS
So values are here, but not working properly
