Forums

reload a textbox or a textarea not working

emmexx 17 Oct, 2018
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:
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
healyhatman 17 Oct, 2018
TL;DR: Value of text field not set by reload event.

I wouldn't mind a fix for this either.
emmexx 18 Oct, 2018

TL;DR: Value of text field not set by reload event.


No, it is not like that, the value is set but it's not computed dynamically. If I set the Value of the control to "some value", after the reload "some value" is displayed. The problem is if I want to display some value based on the choice of the trigger control.


I wouldn't mind a fix for this either.


So let's remove the Reload event property from the controls that don't use it, so I will not waste my time trying to understand why it is not working or why only properties like Label or Placeholder are updated correctly but not the value. Who cares of updating the Label or the Placeholder of a control?

I'm sorry but I don't agree with you.

If I need to fill some fields based on a dropdown choice I have to remember that for dropdowns I can use the reload event feature but for other controls I have to use a function event and write my own js code. Why?

maxx
healyhatman 18 Oct, 2018
It's exactly like that - you use the "reload" event and the field's value is not properly set. It SHOULD be set, clearly, but it's not.
emmexx 18 Oct, 2018

It's exactly like that - you use the "reload" event and the field's
value is not properly set. It SHOULD be set, clearly, but it's not.


I'm sorry, english is not my native language so probably I misunderstood what you wrote but does "I wouldn't mind a fix for this either." mean that you're in favor of a fix? And (OT) does "I would mind a fix for this either." mean that you're against a fix?
healyhatman 18 Oct, 2018
1 Likes
It means I would like it to be fixed
This topic is locked and no more replies can be posted.