Forums

Force reload action

touretteroma 17 Oct, 2018
Dear all,
I have an input text. OnChange it, I have a couple of reload events on 2 other elements. Please, have a look to

How is possible to force reload event programmatically, by Javascript module at the end of the Design section?
Is there any element.zip2.onchange() to call in order to trigger the reload actions?
Thanks
Regards
healyhatman 17 Oct, 2018
jQuery('input[name="field_name"]').change();
touretteroma 18 Oct, 2018
I'm sorry, but it doesn't work.
I have a Javascript module in Design, with "Add inside domready event" flagged to true.

Then, I set the value in zip2 element using:[pre]const input = document.querySelector("input[name='zip2']");
input.value = '00144';[/pre]
But neither
jQuery('input[name="zip2"]').change();
nor
jQuery('input[name="municipality2"]').change();
jQuery('input[name="province2"]').change();
cause the reloading of the dropdowns "municipality2" and "province2".
Only clicking the mouse inside the "zip2" element causes the reload.
I'm using Chronoform6 with PHP7 on Joomla 3.8.12[br]Regards
healyhatman 18 Oct, 2018
Yeah that's not going to work, those are applied when the DOM is ready, as in the HTML is loaded. It's most likely being executed before the js code for the form is applied. You're better off setting the value of the fields initially instead of waiting for the form to load and then loading more.
touretteroma 18 Oct, 2018
Sorry, I didn't catched.
I need to value in "zip2" once page is fully loaded and then force the "reload" of the 2 other components.
Therefore, flag should be set... but .change() method doesn't cause the reload.
Any solution?
healyhatman 18 Oct, 2018
Set the value in the value field in the designer
This topic is locked and no more replies can be posted.