So I have a form with a cfdiv in it that changes t...
# cfml-general
g
So I have a form with a cfdiv in it that changes the 2nd select box when you change the first select. But when the form submits the field that is in the cfdiv value doesn't get passed in the form object. I believe this used to work maybe years ago.
The related selects function properly. I just don't understand why the field value in the cfdiv isn't in the form object.
d
I'd recommend moving away from cfdiv to regular JS and form manipulation.
m
Gus, when you look at the rendered HTML, does the SELECT object look fine? Name, etc? Closing tag, all that?
g
Mark, I can't see the second select in the view source. Just the div <div id="spec_sel"></div>
m
OK yeah, so if it doesn't exist in the DOM, it won't be passed. These old dynamic cf front end bits don't really work well at all these days. You might consider using a framework of some sort, something simple like JQuery or even HTMX to pull in the items, since cfdiv is kind of "black-boxy" and the libraries supporting it are pretty old.
g
Think I could simply pass the value of the select box in the cfdiv to a hidden input in the form with js?
I don't have the flexibility to re-engineer the whole thing right now.
It used to work maybe 10 years ago. Something must have changed in CF regarding cfdiv.
m
You're running this on CF2021? I can ask the team if they've updated any of the libraries that run underneath cfdiv in the last 10 years or so.