I expected the reload feature to work not only with dropdowns but with other controls too but that is not the case.
It seems that the target control can only be a dropdown.
How to reproduce:
I start from the chronoforms demo "Dynamic dropdowns".
I add a textbox control and set the Label to MyText {var:options} and Value to {var:options}
I change the element identifier in the event of the field_select1.
I change the php options code in Setup to:
I select an element from the 1st dropdown, I expect to see "MyTextfoo" in my text box Label and "foo" as the value.
Unfortunately I see only MyTextfoo" in the Label.
Let's do it more complicated!
I set the Value of the textbox to {date:}{var:options}.
Now I expect that each time I select a value from the dropdown, the value of the textbox will be at least changed to the current date.
I reload the page and the textbox value is the current datetime. So shortcodes are working in the Value field.
I wait a few seconds then I select an option from the dropdown and expect the datetime value to update. Instead it stays the same.
I checked the ajax request and the value returned is always the one displayed when I loaded the form.
It seems as if the return value of the event is being computed when the form is loaded and not updated dynamically as it is for dropdowns.
And a little bit more weird: I set the Label of the textbox to MyText {var:options}{date:} and... each time I select the 1st dropdown, the datetime in the label is updated!
Same problem in ChronoConnectivity.
Is this behaviour by design?
To be able to load dynamically the value of controls other than dropdowns would be a useful feature. So you don't have to add a js element and manage this dynamic behaviour adding your own ajax call.
bye
maxx
It seems that the target control can only be a dropdown.
How to reproduce:
I start from the chronoforms demo "Dynamic dropdowns".
I add a textbox control and set the Label to MyText {var:options} and Value to {var:options}
I change the element identifier in the event of the field_select1.
I change the php options code in Setup to:
return 'foo';I save and preview the form.
I select an element from the 1st dropdown, I expect to see "MyTextfoo" in my text box Label and "foo" as the value.
Unfortunately I see only MyTextfoo" in the Label.
Let's do it more complicated!
I set the Value of the textbox to {date:}{var:options}.
Now I expect that each time I select a value from the dropdown, the value of the textbox will be at least changed to the current date.
I reload the page and the textbox value is the current datetime. So shortcodes are working in the Value field.
I wait a few seconds then I select an option from the dropdown and expect the datetime value to update. Instead it stays the same.
I checked the ajax request and the value returned is always the one displayed when I loaded the form.
It seems as if the return value of the event is being computed when the form is loaded and not updated dynamically as it is for dropdowns.
And a little bit more weird: I set the Label of the textbox to MyText {var:options}{date:} and... each time I select the 1st dropdown, the datetime in the label is updated!
Same problem in ChronoConnectivity.
Is this behaviour by design?
To be able to load dynamically the value of controls other than dropdowns would be a useful feature. So you don't have to add a js element and manage this dynamic behaviour adding your own ajax call.
bye
maxx