Copy link to clipboard
Copied
Good evening,
For my recordings, I have always gone through CFForm but this leads to the opening of another page.
Is there another way that does not go through a new page in order to be able to easily use the modal windows
thanks in advance
Copy link to clipboard
Copied
No help?
How to use modal windows with Coldfusion?
Thank you
Copy link to clipboard
Copied
This is a really complicated question, it's hard to give you a simple answer. The best simple answer I can give is "learn to use JavaScript". I don't mean this to be glib, but that's really what you have to do. Fortunately, this is not all that hard to do, but it does require a lot of time and effort.
In general, what you want is some JavaScript that will invoke various ColdFusion URLs via AJAX calls. There are plenty of JavaScript libraries that can help you out with this, but then you have to learn at least some of the library along with JavaScript itself.
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
What have you tried? What web development skills outside of ColdFusion do you have? I don't consider this a ColdFusion-related issue unless you are specifically attempting to use the CFUI tags.
I use modal windows in my applications (both ColdFusion and non-ColdFusion) by using the jQuery Magnific Popup library. Prior to using Magnific, we used the jquery ColorBox plugin. Both of these plugins allow you to use a hidden div on your webpage without having to create an iFrame or perform an ajax request. We use all 3 methods of generating forms based on what we are trying to accomplish. Your needs may vary.
If you want to search for some alternatives, here's a Google search query for javascript modal libraries.
Copy link to clipboard
Copied
Suggestion:
1) let the cfform submit to the page in which the form is.
2) enclose the code that generates the modal window within a <cfif></cfif>
I shall illustrate with 2 CFM files:
testPage2.cfm
testPage2.cfm: Contents of the modal window.
and
testPage1.cfm whose code is below
<cfif isDefined("form.fieldnames")>
<!--- Process the form here --->
<cflog text="Welcome, #form.username#. This log confirms we're in the action page of the cfform in the modal window test" file="modalWindowTest" type="information">
<!--- Modal window. Its content comes from testPage2.cfm --->
<cfwindow
name="ModalWindow"
title="Modal Window"
initshow="true"
resizable="false"
height="400"
width="450"
modal="true"
source="testPage2.cfm">
</cfwindow>
</cfif>
<!--- Form submits to same page. That is, this same page is the form's action page.--->
<cfform action="#CGI.SCRIPT_NAME#">
<p>Please enter your name:
<cfinput type="Text" name="UserName" required="Yes"><p>
<input type="Submit" name="submit" value="Send">
<input type="RESET" name="reset" value="Reset">
</cfform>
Now check the log file, modalWindowTest.log
Copy link to clipboard
Copied
Thanks for your help !
I'm going to try.
Thank you
Copy link to clipboard
Copied
Thanks for your help !
Sorry, but I don't know what to put in testPage1.cfm and testPage2.cfm for the demonstration.
Thanks again