Copy link to clipboard
Copied
Hello, everyone.
Tried googling this one and found no examples for this specific question.
Another developer that I work with has a form in which one of the CFSELECTs is dynamically populated by a query. The form also contains two CFINPUT type="text" fields that contain dates; 1/1/currentyear in one, and the current date in the other. The default dates are set at the top of the document and are used in the query that populate the CFSELECT.
What he is attempting to do is develop so that whenever one of the two date fields changes, the query is run with the new date and the CFSELECT repopulated, without reloading the page.
I am pretty sure this would be done with a bind attribute on both of the date CFINPUTs, but I'm very new to the whole bind parameter experience.
I'm also assuming that the query would have to be put inside a method in a CFC and invoked on page load, then accessed via the bind.
Can anyone please help me with this?
Copy link to clipboard
Copied
If the query depends on those dates, the first thing you will have to do is to ensure the user entered a valid date. The next thing would be to ensure that the dates are still in the expected order, and depending on the circumstances not to far apart. You probably want to do this with js.
Once your dates pass muster, you can use js to send the info to cf and get it back. There is more than one way to accomplish this. My choice would be with an inline frame and innerHTML, but that's because I can't use anything more modern than cf7.
The file in the iframe would have to be .cfm. Whether it has a cfquery tag or calls the query from a cfc depends on other circumstances.
Copy link to clipboard
Copied
Form validation comes after I figure out how to do what I need to do. And it can be done with a CFINPUT parameter, anyway.
Although the date fields can be manually edited by the user, there is a calendar.js function that will display a calendar in a div that allows the user to select a date in either field.
Inline frames and innerHTML could do it via JavaScript, but I'm sure there is a CF bind solution (it might involve JavaScript) that I'm looking for.
^_^