- March 23, 2021 at 7:52 am #32753
is there a smart way on dynamic replace options of a radio select from one page based on say the radio selected on another page. Technically its probably irrelevant if its the same or different page.
If it would be a simple select or radio button I could simply use an ajax call and replace the options, but the radios I want to replace are using the option style “button”, so the markup is a little more complex. Any recommended way of handling this?March 23, 2021 at 11:05 am #32754March 23, 2021 at 4:15 pm #32755
Great, exactly what i was looking for.
There’s only a small problem now. If i replace the content of Option Field 2, the conditional logic no longer works for it. i want to show a a third option field when selecting a value in the second one. I guess the event listener is removed once i use .replaceWith….March 24, 2021 at 9:01 am #32758March 24, 2021 at 11:09 am #32760
Thx Ally, that worked.
Now i have one more minor problem.
Option field 3 is actually dynamically populated as well, based on Option Field 2. i used the same code you provided me before. That works.
The minor problem is, that as its a ajax request and the fields are on the same page, the field shows instantly when changing Option Field 2 and then after the Ajax request is completed the options get replaced. Would be nice if could wait to show field 3 after the request.
My solution to that would probably be to disable the conditional logic in the editor and do manually with jS. Or is there another solution?
Thank you!March 25, 2021 at 10:30 am #32764
- You must be logged in to reply to this topic.