input text field VALUE from ReadData database

pachf11 20 Aug, 2017
I can't insert matching instruction in value field. Have field empty or with some html taags. When I write to: {user:id} it shows me number of user id - is ok, when try with function empty - it's ok - return 1. I tryed for many options and don't have idea how use data from read data query. Please help!
Max_admin 20 Aug, 2017
Hi pachf11,

First, the read data must be BEFORE the "display section", then you can use a "Debugger" to display what data is available for usage, the data of any action is available under {var:action_name}, but the exact path is visible in the debug output.

Please check the manual or post the debug results and I can explain how to find the path.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
pachf11 21 Aug, 2017
Hi Max

I have readdata on first position, second is display. I used debugger and found interesting me data. This is from the debugger:

Array
(
    [language] => pl-PL
    [format] => html
    [Itemid] => 453
    [option] => com_content
    [lang] => pl-PL
    [view] => article
    [id] => 11
    [ark_inine_enabled] => 1
    [arkoption] => com_content
    [com_content.article.-1289027624] => 1
)
Array
(
    [read_data9] => Array
        (
            [log] => Array
                (
                    [0] => SELECT COUNT(`CH_MODEL_USER`.`virtuemart_userinfo_id`) AS `CH_MODEL_USER.count` FROM `joom_virtuemart_userinfos` AS `CH_MODEL_USER` WHERE `CH_MODEL_USER`.`virtuemart_user_id` = '907';
                    [1] => SELECT `CH_MODEL_USER`.`title` AS `CH_MODEL_USER.title`, `CH_MODEL_USER`.`first_name` AS `CH_MODEL_USER.first_name`, `CH_MODEL_USER`.`last_name` AS `CH_MODEL_USER.last_name` FROM `joom_virtuemart_userinfos` AS `CH_MODEL_USER` WHERE `CH_MODEL_USER`.`virtuemart_user_id` = '907' LIMIT 30;
                )

            [var] => Array
                (
                    [0] => Array
                        (
                            [CH_MODEL_USER] => Array
                                (
                                    [title] => 
                                    [first_name] => Paweł
                                    [last_name] => Chojaczyk
                                )
                        )
                )
        )
)


END DEBUG

I tryed {data:xxx} and {var:xxx} but couldn't find resolve.

Thank You
Paweł
Max_admin 22 Aug, 2017
Answer
Hi Pawel,

In order to get the first_name from the data you need to use the following:
{var:read_data9.0.CH_MODEL_USER.first_name}

But if you are planning to load ONE record only then you better set the "Select type" in the "Read data" to "First matching", you can then use:
{var:read_data9.CH_MODEL_USER.first_name}


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
pachf11 25 Aug, 2017
1 Likes
Great! Now it's function OK. Thank You very much!

Best Regards

Paweł
vividal 29 May, 2018
I am having this same issue and I think I have the syntax correct but my field is still blank. On my form I have a drop down that selects a users name. Then I have an event that reads the data (selecting 1st matching record). According to the debug it is finding the record I expect but it is not populating the next field with the value. Any thoughts on what I have wrong based on the debug and field syntax below:

Array
(
    [read_data10] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `JMUSERID`.`aid` AS `JMUSERID.aid`, `JMUSERID`.`jmid` AS `JMUSERID.jmid` FROM `film_vw_users` AS `JMUSERID` WHERE `JMUSERID`.`aid` = '2' LIMIT 100;
                )

            [var] => Array
                (
                    [JMUSERID] => Array
                        (
                            [aid] => 2
                            [jmid] => 58
                        )

                )

        )

)
The Value of the field I want to populate is
{var:read_data10.JMUSERID.jmid}

I would expect it to be 58 but it remains blank. thoughts?
GreyHead 29 May, 2018
Hi vividal,

I'm not clear where these things are happening. Is the read data after the first part of the form (with the drop down) is submitted?

Bob
vividal 29 May, 2018
Sorry for the confusion. The form has 5 fields (fields 3-5 work fine). Field1 (filmuser_id) is a drop down where I select the a value. It has a reload action on change for element id jmid1. Field 2 (jmid1) has a reload event GetJMID which is where the debug is displayed after loading the value based on the selection from field1.
Max_admin 08 Jun, 2018
Hi,

The syntax of the shortcode is correct, but the read data should be inside the same event of the "reload" and BEFORE the "custom code" action used to render the field.

You may also try to call the shortcode directly from the "custom code" {var:read_data10.JMUSERID.jmid}

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cambium 20 Jan, 2019
Oh, it works now.
Earlear, i tried to use this command into wrong place (in text field of form, but display section function is into success event of read data function) it is the reason could't output the data as i think
Elita- 11 Oct, 2019
Hello to all >

Max,
Is this all written above still apply with the latest CF6 update ? I cannot get why I cannot populate text field with the instructions above .

To reload the text field I have a standalone action named load_katUCI with [read_data255] action and custom code with following code inside:
{var:read_data255.model.katUCI}
{view:field_text987}
Read function works as expected (see Debug below).
However I cannot get the needed data INSIDE THE TEXT FIELD.
Funny thing is that I can get that value to be printed OUTSIDE the text field, as my debug shows🙂 when I enter the following code AFTER the view code. Any ideas?
after texfield view: {var:read_data255.model.katUCI}

input text field VALUE from ReadData database image 1
Elita- 11 Oct, 2019
Sorted that out using this thread:
http://www.chronoengine.com/forums/posts/t107640/populate-field-value-after-selecting-value-in-dropdown?keywords=dynamically%20populate%20text%20field
- I had an php action code missing.


that is a litle bit weird though🙂 - is this the correct way of doing this, Max?

Thanks!
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger