CFFORM Function
Hello,
I'm trying to create a cfform that takes has a selectable
drop down and 2 date selector. THe CFselect is to pick the Gender,
I have 2 cfcalendar for a start and end date. Then with a submit
button. Upon clicking it should go and query my database and return
all entries within the data range selected and filter by gender. I
will display the information on the same page in a seperate panel
using cfgrid. This is what I have so far, but do not know where to
go from here. I'm trying to get this done and have been working on
this for the last few weeks. Any help is muchly appreciated!!!
Thanks,
hhr_jb
ColdFusion is simply behaving as it should. You will notice that the script that currently runs upon onSubmit ends in a return-statement. That signals the end of the event-handler.
If you wish to check the e-mail as well, you could run one script that performs both functions. I was thinking of something like the following, just off the cuff
onsubmit="if(!document.getElementById('Agree').checked) {alert('You must agree to the Terms and Conditions'); return false; } else {return checkEmail(this);}">
Similar Messages
-
Hello people. I'm trying to learn this concept but something just don't want to work.
I have tried some Ajax-codes like <cfgrid> or <cfinput type="datefield"...> but it did'nt work.
The calender, that should be shown is simply not there.
I've read that is no need to install some plug-in. Is that correct?
Please, what I am doing wrong.
Thank you.
Cristiano
<cfform>
<cfinput type="datefield" name="Date" />
</cfform>function(){return A.apply(null,[this].concat($A(arguments)))}
function(){return A.apply(null,[this].concat($A(arguments)))}I found the directory in: C:\Inetpub\wwwroot\CFIDE\scripts
No idea why that's there.
That suggests you chose during installation to set the web server. The alternative would have been to choose Coldfusion's own in-built web server.
The directory you found is correct. It is the standard directory for running Coldfusion with IIS as web server. Since you know nothing about it, I have to assume that you mistakenly made that choice during installation. If you had chosen the in-built web server, the corresponding directory would have been C:\Coldfusion8\wwwroot\scripts.
There are two ways to go from here. Either configure Coldfusion to use its own in-built web server(JRun), or else just continue with IIS as web server.
If you are not yet comfortable with Coldfusion or IIS, then I would advise the first solution. You may uninstall Coldfusion, then re-install it, choosing the the in-built web server (There will be a screen offering you the choice). This has the advantage of being a clean beginning.
If you find that drastic, then you can simply disable IIS as web server. To do so, follow these steps (Beware: I am running on instincts here. What follows is untested, and the risk is yours):
1) Copy (without deleting) everything from the directory C:\Inetpub\wwwroot\ to the directory C:\Coldfusion8\wwwroot\. That will be the new web root directory;
2) Navigate to Start=>Programs=>Adobe=>Coldfusion8 and open the Web Server Configuration Tool. (Alternatively, double-click on the file C:\Coldfusion8\runtime\lib\wsconfig.jar);
3) Remove any web servers in the list;
4) Restart Coldfusion, and you're done.
5) Test by opening http://127.0.0.1:8500/CFIDE/administrator/ in the browser.
If, instead, you decide to continue with IIS, then you should configure IIS for use with Coldfusion. -
Excute Oracle function using data from a CFFORM
For simplicity, I have a function that will add 1 to a number
a user will enter from a form. So if the user enters the number 2
and submits the form, the next page will display 3.
If I enter the following code in SQL Plus, I get 3:
SELECT MySchema.Add_Function('2') FROM dual;
3
This is correct.
How do i get this to work?
<cfquery name="funcTest" datasource="Test">
SELECT MySchema.Add_Function('#FORM.userNumber#') FROM dual;
</cfquery>
<body>
Your new number is
<cfoutput>#funcTest.Add_Function('#FORM.userNumber#')#</cfoutput>
</body>
I get
ELEMENT Add_Function('2') is undefined in funcTest.
Any ideas?
THANKSCross-post
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=6&threadid=13 06590 -
Not possible to output CFTREEITEM in a CFC function?
Hi there,
I am parsing a sorted list of strings (in the form of a/b/c/,
a/b/c, /a/c/d etc.) and trying to make a treeview out of it.
I have the CFFORM and CFTREE tag in the top function and the
code that generate CFTREEITEM in a subfunction, but I got the
following error:
Context validation error for tag cftreeitem.
The tag must be nested inside a cftree tag.
It seems that ColdFusion doesn't recognize that calling code
is already nested inside a CFTREE tag in the top function. I
extract the code generating CFTREEITEMs to a sub function because
it is called multiple times from different context, it would be a
lot of hassle and quite stupid to "inline" it.
If what I am trying is, for whatever reason, not possible,
would it be possible then to have the sub function generate the
code into a string and somehow dynamically evaluate that?
Any hints or tips will be greatly appreciated!
BillyHi there,
I am parsing a sorted list of strings (in the form of a/b/c/,
a/b/c, /a/c/d etc.) and trying to make a treeview out of it.
I have the CFFORM and CFTREE tag in the top function and the
code that generate CFTREEITEM in a subfunction, but I got the
following error:
Context validation error for tag cftreeitem.
The tag must be nested inside a cftree tag.
It seems that ColdFusion doesn't recognize that calling code
is already nested inside a CFTREE tag in the top function. I
extract the code generating CFTREEITEMs to a sub function because
it is called multiple times from different context, it would be a
lot of hassle and quite stupid to "inline" it.
If what I am trying is, for whatever reason, not possible,
would it be possible then to have the sub function generate the
code into a string and somehow dynamically evaluate that?
Any hints or tips will be greatly appreciated!
Billy -
Redirect to two separate pages in the same cfform
I'm a bit of a novice at this.Hoping someone can guide me on how to accomplish this. I have a simple selection list (below). If they user chooses the selection in red I want it to redirect them to a page other than the one in the cfform tag, but I can't figure out how to segregate the options within the cfform from the same list. Thanks in advance.
<cfform action="index2.cfm" method="POST">
<table align="center" width="475" border="0" cellpadding="1" cellspacing="0">
<tbody>
<tr>
<td><span class="label">Select Version:</span> </td>
<td>
<cfselect name = "UPVersion">
<option value=""></option>
<option value="66SP1">6.6 SP1x</option>
<option value="66SP2">6.6 SP2x</option>
<option value="701">7.0.1x</option>
</cfselect>
</td>
</tr>
<input type="hidden" name="gosearch" value="gosearch">
<input type="hidden" name="Rows" value="50">
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit" value="[ search ]"> <input type="reset" name="reset" value="[ clear ]"></td>
</tr>
</tbody>
</table>
</cfform>The sample code I provided is reduced down to show a concept of how I solved the multiple processing based upon user selection criteria.
Looping throught the FORM.FIELDNAMES was provided as an easy way to capture the fieldnames and their values.
Process1,cfm and Process2.cfm were used to show 2 different processing pages. They do not exist and are examples.
I use this logic on many pages and it works well.
You are correct that you need to further refine the code using the javascript or URL to pass the form variables.
<CFLOOP list="#Form.FieldNames#" index="i">
<CFIF CurrentRow EQ 1>
<CFSET z = "?#i# & "=" & #Evaluate("Form." & "#i#")#">
<CFElSE>
<CFSET z = #z# &", " & "#i# & "=" & #Evaluate("Form." & "#i#")#">
</CFIF>
</CFLOOP>
<CFIF #Form.X# EQ 1>
<CFLOCATION Url = "process1.cfm#z#">
<CFELSE>
<CFLOCATION Url = "process2.cfm#z#">
</CFIF>
You could also process both functions on one page.
<CFIF IsDefined("Form.UPVersion") and #Form.UPVersion# EQ "7.0.1x">
Do special processing
<CFELSE>
Do Normal Processing
</CFIF> -
Need suggestion to achieve this functionality
Hi,
I was looking at cfgrid and cftree functionality. Is it possible to incorporate cftree within cfgrid. if I can create a tree like structure in cfgrid. I am looking for something like below: The hyphens would be replaced by checkboxes...
- Folders
- subdfolder1
- subsubfolder1
- subsubfolder2
- subfolder2
- subsubfolder1
- subsubfolder2
- Folder2
- etc...
I am looking for something rich looking solution. It would be great if you can give some suggestion on theseGrid and Tree are alternative ways of representing data in two dimensions. One is a table, the other, well, a tree.
The addition of checkboxes is also superfluous, because a cfgrid or cftree enables you to make a selection. However, there's nothing stopping you from putting 2 or more trees in a form.
Here is an example I borrowed from the Adobe Livedocs on cftree . The cfdocexamples datasource is pre-installed in Coldfusion, so you can run it directly.
<cfquery name="getCourses" datasource="cfdocexamples">
SELECT d.dept_name, c.course_id, c.CorName, c.CorLevel, c.corName ||' ( ' ||c.corLevel ||' )' AS corLabel
FROM CourseList c, Departments d
WHERE d.Dept_ID = c.Dept_ID
ORDER BY d.dept_Name, c.corName, c.corLevel
</cfquery>
<cfform name="studentForm" format="flash" width="400" height="450">
<cfformgroup type="vertical">
<cftree name="courseTree1">
<cfinput type="checkbox" name="chkbx1">
<cftreeitem
query="getCourses"
value="dept_name,Course_id"
display="dept_name,CorLabel" queryasroot="NO" expand="yes,no">
</cftree>
<cftree name="courseTree2">
<cfinput type="checkbox" name="chkbx2">
<cftreeitem
query="getCourses"
value="dept_name,course_id"
display="dept_name,corName" queryasroot="NO" expand="yes,no">
</cftree>
</cfformgroup>
</cfform> -
CFFORM onSubmit script works in FF but not in IE
I've got a CFFORM that has an onSubmit additional javascript for form validation, and while it works in FF, it passes right through in IE and ends up erroring because the mandatory fields aren't there...
the CFFORM call looks like this
<cfform name="add_project" method="post" action="xxxxxxx.cfm?view=admin-add-process&entity=project" enctype="multipart/form-data" onsubmit="return checkReq();">
and the function looks like
<script language="javascript">
function checkReq() {
var valid = true;
var errMsg = '';
if (document.add_project.projectreviewer_emails.value.trim() == '') {
} else {
</script>
Any ideas?
Thanks in advance,
bwThere is some doubt regarding the universality of Javascript's trim function among browsers. Is it vital here? If you leave it out, your code will work across all browsers. Something along the lines of:
<script type="text/javascript">
function checkReq() {
var valid = true;
var errMsg = '';
var projectReviewerEmails = document.forms["add_project"]["projectreviewer_emails"].value;
if (projectReviewerEmails == '') {
// no no no no no
return !valid;
} else {
// yeah yeah yeah yeah yeah
return valid;
</script>
<cfform name="add_project" method="post" action="test.cfm?view=admin-add-process&entity=project" enctype="multipart/form-data" onsubmit="return checkReq();">
<cfinput type="file" name="projectreviewer_emails" >
<cfinput type="submit" name="sbmt" value="Submit">
</cfform> -
In my CFFORM I first call my javascript then some cfinput
fields are required. In test my codes behaves what it supposed to
be. CF server creates its javascripts for those required fields and
replace the USER DEFINED JAVASCRIPT on my onsubmit with coldfusion
generated function or scripts then at the of those scripts it calls
my USER DEFINED JAVASCRIPT , which is how supposed to work. But
when I deploy it to production the CFFORM return my user defined
javascript to be called under onsubmit instead of
_CF_checkMyForm(_CF_this) since I those required fields. I noticed
in the source code it creates these functions
_CF_checkMyForm(_CF_this) and the validations for the required
fields. Only the "onsubmit" hasn't give the right command...
instead of onsubmit = _CF_checkMyForm(_CF_this) it calls the user
defined one.Verify your CFIDE virtual directory in production is
configured correctly. There's a .js file in cifde/scripts that
needs to get called. -
I am lost, I am new to ColdFusion and am trying to create a "Contact Us" page. I have a form made up with all the fields that I need on the page. I want it to email the form to "[email protected]" upon hitting submit. However I am stuck and cannot get the form to work properly. Can somebody, anybody help
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main-2-col.dwt.cfm" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Contact </title>
<meta name="keywords" content="emergency management, consultants" />
<meta name="description" content="Consultants" />
<meta name="robots" content="index,follow" />
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="styles/styles-index.css" rel="stylesheet" type="text/css" />
<link href="styles/styles-index-col-table.css" rel="stylesheet" type="text/css" />
<link href="styles/styles-index-mobile.css" rel="stylesheet" media="handheld" type="text/css" />
<script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>
<script type="text/javascript">
<!--
function _CF_checkCFForm_1(_CF_this)
//reset on submit
_CF_error_exists = false;
_CF_error_messages = new Array();
_CF_error_fields = new Object();
_CF_FirstErrorField = null;
//form element Name required check
if( !_CF_hasValue(_CF_this['Name'], "TEXT", false ) )
_CF_onError(_CF_this, "Name", _CF_this['Name'].value, "Please enter your name.");
_CF_error_exists = true;
//form element Phone required check
if( !_CF_hasValue(_CF_this['Phone'], "TEXT", false ) )
_CF_onError(_CF_this, "Phone", _CF_this['Phone'].value, "Please enter your phone number.");
_CF_error_exists = true;
//form element Email required check
if( !_CF_hasValue(_CF_this['Email'], "TEXT", false ) )
_CF_onError(_CF_this, "Email", _CF_this['Email'].value, "Please enter your email.");
_CF_error_exists = true;
//form element Answer required check
if( _CF_hasValue(_CF_this['Answer'], "TEXT", false ) )
//form element Answer 'INTEGER' validation checks
if (!_CF_checkinteger(_CF_this['Answer'].value, true))
_CF_onError(_CF_this, "Answer", _CF_this['Answer'].value, "Please enter the answer.");
_CF_error_exists = true;
}else {
_CF_onError(_CF_this, "Answer", _CF_this['Answer'].value, "Please enter the answer.");
_CF_error_exists = true;
//display error messages and return success
if( _CF_error_exists )
if( _CF_error_messages.length > 0 )
// show alert() message
_CF_onErrorAlert(_CF_error_messages);
// set focus to first form error, if the field supports js focus().
if( _CF_this[_CF_FirstErrorField].type == "text" )
{ _CF_this[_CF_FirstErrorField].focus(); }
return false;
}else {
return true;
//-->
</script>
</head>
<body>
<!--- define the action page in the form tag. The form variables will
pass to this page when the form is submitted --->
<a name="Top" id="Top"></a>
<div id="masthead"></div>
<div id="topnav"> <ul>
<li><a href="index.cfm">Home</a></li>
<li><a href="philosophy-mission.cfm">PHILOSOPHY & MISSION</a></li>
<li><a href="services.cfm">SERVICES</a></li>
<li><a href="contact.cfm">CONTACT</a></li>
<li><a href="about-us.cfm">ABOUT US</a> </li>
<li><a href="index.cfm">HOME</a></li
</ul>
</div>
<div id="contentouter">
<div id="content"><!-- InstanceBeginEditable name="body" -->
<div id="middlecontent">
<h1>Contact Us</h1>
<p>Phone: ###-###-####</p>
<p>Postal: </p>
<hr />
<h2>Information Request Form </h2>
<div id="form">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<p align="center">Please complete the fields below and we will respond to your inquiry within 48 hours.</p>
</td>
</tr>
</table>
<p></p>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<p align="right">First Name:</p>
</td>
<td>
<p><input type="text" name="First Name" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Last Name:</p>
</td>
<td>
<p><input type="text" name="Last Name" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Address Street 1:</p>
</td>
<td>
<p><input type="text" name="Address Street 1" size="30" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Address Street 2:</p>
</td>
<td>
<p><input type="text" name="Address Street 2" size="30" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">City:</p>
</td>
<td>
<p><input type="text" name="City" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Zip Code:</p>
</td>
<td>
<p><input type="text" name="Zip Code" size="5" maxlength="5" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">State:</p>
</td>
<td>
<p><select name="State">
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="DC">DC</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IA</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="ME">ME</option>
<option value="MD">MD</option>
<option value="MA">MA</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MS">MS</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="NE">NE</option>
<option value="NV">NV</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NY">NY</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VT">VT</option>
<option value="VA">VA</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WI">WI</option>
<option value="WY">WY</option>
</select></p>
</td>
</tr>
<tr>
<td>
<p align="right">Daytime Phone:</p>
</td>
<td>
<p><input type="text" name="Daytime Phone" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Evening Phone:</p>
</td>
<td>
<p><input type="text" name="Evening Phone" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Email:</p>
</td>
<td>
<p><input type="text" name="Email" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Comments:</p>
</td>
<td>
<p><textarea name="Comments" cols="38"></textarea></p>
</td>
</tr>
</table>
<p><!-- submit button --><input type="submit" name="SubmitForm" value="Submit">
<!-- reset button --> <input type="reset" name="ResetForm" value="Clear Form"></p>
</div>
</div>
<div id="rightcontent">
<h2>Located where you and your business are.</h2>
<p>Upon setting up a seminar date we will travel to your location. </p>
</div></form>
<!-- InstanceEndEditable --></div>
<div id="contentpush"></div>
</div>
<div id="footer">
<p><a href="#Top">Return to Top</a></p>
<p><a href="index.cfm">Home</a> | <a href="philosophy-mission.cfm">Philosophy & Mission</a> |
<a href="services.cfm">Services</a> | <a href="contact.cfm">Contact</a> | <a href="about-us.cfm">About Us</a> | <a href="index.cfm">Home</a></p>
</div>
</body>
</html>1) The Javascript tags suggest you want automatic validation for the form fields. The proper tag for this is <cfform>. Simply add the attributes 'required' to the input fields. Coldfusion would then automatically generate the Javascript for you.
2) You should surround a comment in Coldfusion like this <!--- comment --->, not like this <!-- comment -->.
3) Remove any redundant information.
4) The cfmail tag will be in the action page which, in my example, is myActionPage.cfm.
<html>
<head>
<title>Contact </title>
<meta name="keywords" content="emergency management, consultants" />
<meta name="description" content="Consultants" />
<meta name="robots" content="index,follow" />
<link href="styles/styles-index.css" rel="stylesheet" type="text/css" />
<link href="styles/styles-index-col-table.css" rel="stylesheet" type="text/css" />
<link href="styles/styles-index-mobile.css" rel="stylesheet" media="handheld" type="text/css" />
</head>
<body>
<a name="Top" id="Top"></a>
<div id="masthead"></div>
<div id="topnav"> <ul>
<li><a href="index.cfm">Home</a></li>
<li><a href="philosophy-mission.cfm">PHILOSOPHY & MISSION</a></li>
<li><a href="services.cfm">SERVICES</a></li>
<li><a href="contact.cfm">CONTACT</a></li>
<li><a href="about-us.cfm">ABOUT US</a> </li>
<li><a href="index.cfm">HOME</a></li
</ul>
</div>
<div id="contentouter">
<div id="content">
<div id="middlecontent">
<h1>Contact Us</h1>
<p>Phone: ###-###-####</p>
<p>Postal: </p>
<hr />
<h2>Information Request Form </h2>
<div id="form">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<p align="center">Please complete the fields below and we will respond to your inquiry within 48 hours.</p>
</td>
</tr>
</table>
<!--- define the action page in the form tag. The form variables will
pass to this page when the form is submitted --->
<cfform action="myActionPage.cfm" method="post">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<p align="right">First Name:</p>
</td>
<td>
<p><cfinput type="text" name="FirstName" required="yes" message="Please enter your first name." /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Last Name:</p>
</td>
<td>
<p><cfinput type="text" name="LastName" required="yes" message="Please enter your last name." /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Address Street 1:</p>
</td>
<td>
<p><cfinput type="text" name="Address_Street_1" size="30" required="yes" message="Please enter your addres." /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Address Street 2:</p>
</td>
<td>
<p><cfinput type="text" name="Address_Street_2" size="30" required="yes" message="" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">City:</p>
</td>
<td>
<p><cfinput type="text" name="City" required="yes" message="Please enter your city." /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Zip Code:</p>
</td>
<td>
<p><cfinput type="text" name="ZipCode" size="5" maxlength="5" required="yes" message="Please enter your zip code." /></p>
</td>
</tr>
<tr>
<td>
<p align="right">State:</p>
</td>
<td>
<p><cfselect name="State">
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="DC">DC</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IA</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="ME">ME</option>
<option value="MD">MD</option>
<option value="MA">MA</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MS">MS</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="NE">NE</option>
<option value="NV">NV</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NY">NY</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VT">VT</option>
<option value="VA">VA</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WI">WI</option>
<option value="WY">WY</option>
</cfselect></p>
</td>
</tr>
<tr>
<td>
<p align="right">Daytime Phone:</p>
</td>
<td>
<p><cfinput type="text" name="Daytime_Phone" required="yes" message="Please enter your daytime phone number." /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Evening Phone:</p>
</td>
<td>
<p><cfinput type="text" name="Evening_Phone" required="yes" message="" /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Email:</p>
</td>
<td>
<p><cfinput type="text" name="Email" required="yes" message="Please enter your email address." /></p>
</td>
</tr>
<tr>
<td>
<p align="right">Comments:</p>
</td>
<td>
<p><cftextarea name="Comments" cols="38"></cftextarea></p>
</td>
</tr>
</table>
<p><!--- submit button ---><cfinput type="submit" name="SubmitForm" value="Submit">
<!--- reset button ---> <cfinput type="reset" name="ResetForm" value="Clear Form"></p>
</div>
</div>
<div id="rightcontent">
<h2>Located where you and your business are.</h2>
<p>Upon setting up a seminar date we will travel to your location. </p>
</div></cfform>
<!---InstanceEndEditable---></div>
<div id="contentpush"></div>
</div>
<div id="footer">
<p><a href="#Top">Return to Top</a></p>
<p><a href="index.cfm">Home</a> | <a href="philosophy-mission.cfm">Philosophy & Mission</a> |
<a href="services.cfm">Services</a> | <a href="contact.cfm">Contact</a> | <a href="about-us.cfm">About Us</a> | <a href="index.cfm">Home</a></p>
</div>
</body>
</html> -
Dynamic Forms (Data Dictionary) using CFForm (??)
Hi,
The basic plan is to build the forms in my application
dynamically using a data dictionary rather than basing them upon
static tables and having statically coded forms to match. This
would allow me to offer the ability for an administrator to add new
fields if required (client 'requirements' are hard to pin down and
may therefore change).
I'm developing using CF8 (hoping it will be released real
soon..;-).). Application will be structured using Fusebox 5.
I've tried building up the form elements (<cfinput>
& etc) off in CFC, returning the layout result code in a
content variable, and its not working.
I have some other approaches to try, but this one would be
preferable.
Has anyone else tried this - and do you have any advice to
offer (or am I just crazy trying it because there is no way its
going to work ?)
Thanks
Bryn50This approach works well using standard html forms and html
form controls such as <input> and <select> etc.
I'm wanting to use CFFORM (for the first time in a long time)
for the functionality on offer (such as flash forms).
As I saw elsewhere, I have not used this in a verrry long
time because generally I've found it inflexible and the validation
on offer is a tiny subset of what is generally needed. I'm kinda
hoping to be able to overcome that this time around by adding my
own javascript validation when necessary.
I have some ideas for approaches that might work, but they
don't seem like very good ones to me:
1/. might be to try using standard html form controls inside
a cfform. Can I still have it display using flash ?
2/. might be to have all of the logic that selects the
appropriate cfform control for a given field in the same file as
the cfform, however that seems so unelegant and also it defies the
MVC/fusebox 5 approach I'm also wanting to use.
Thanks for your help...
Cheers, -
Hi,
I am trying to upload a file with ajax, is there a way to do this using cfajaxproxy or any of the other ajax controls? I usually use uploadify but is not really doing the job in this case.
<cfform>
<h4>Document Title</h4>
<input name="docTitle" id="linkTitle" />
<h4>Document</h4>
<input type="file" name="document" id="document" />
<a href="javascript:submitDoc()">upload document</a>
</cfform>
Thanks,
H.As far as I know, XMLHttpRequest can't handle multipart/formdata, so there's no strictly AJAX way to do it. The CF docs even specify that this is not possible using ajaxproxy's "setform" function:
"Note: You cannot use the setForm function to submit the contents of file fields." (ref)
You can, however, use a hidden iFrame to handle the file uploading, monitor it, and then return the results to your application. I've used this before, and it works well.
Ray Camden has a pretty good article on this..check it out:
http://www.coldfusionjedi.com/index.cfm/2008/2/27/Can-you-do-file-uploads-with-ColdFusion- 8s-Ajax-features
Hope this helps--regards -
I've seen numerous posts relating to similar issues (and have
tried many of their solutions) - but the issue I'm having seems to
be a bit more specific. A cfform type="flash" that is compiled,
displayed, and functions issue free in Firefox (Win, Lin, Mac) and
Safari (Mac) will not display in any flavor of IE. The rest of the
page renders, just not the compiled flash object.
The server is running CF MX 7, I have verified the mappings,
I have placed a copy of CFIDE into the site root, I have tried
using the 'scriptsrc' attribute in the cfform opening tag, I have
tried an unofficial custom tag hack to get around the Eolas issue
that seems to be common - all with no success. No errors are being
generated by the application or the coldfusion server that its
running on. I have tried re-installing and upgrading various
computers to Flash Player 9 as well.
Any suggestions or familiarity with this goofy issue?It's worth fixing some of the 99 errors here too...
http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.smsvb.net%2Fschool%2Findex.ht ml
Jo
"M G 2" <[email protected]> wrote in message
news:fgilo9$9jd$[email protected]..
>I have a page that displays fine in firefox, but not in
IE. In IE, it
>stretches
> the picture across the page. (
http://www.smsvb.net/school/index.html)
I
> thought it was the way I'd structured the tables, but
have checked those
> and
> can't find the problem. I also thought it might be in
the picture width
> and
> height, but changed those and still got the problem. I
posted that at
>
http://www.smsvb.net/school/index2.html.
I've done the browser
> compatibility
> check and dreamweaver only found a few problems in the
spry menu bar
> (which
> doesn't display correctly in IE, either, but that's at
least legible). I
> "fixed" all the "errors" in the menu bar css except one
that was necessary
> (.em; about half way down). I wouldn't think the spry
menu bar would be
> causing the problem, but the problem disappears, it
seems, when I remove
> the
> menu bar -
http://www.smsvb.net/school/index3.html.
As I know next to
> nothing
> about this code, can someone please takea look. It's my
work's web page
> and
> rather embarrassing to have it display so poorly. I've
posted the chunks
> of
> code I changed at
http://www.smsvbnet/school/changes.rft
and the spry css
> is at
>
http://www.smsvb.net/school/SpryAssets/SpryMenuBarHorizontal.css
- thanks
> to
> anyone for looking at this
> -
if you use a cfform this normally overwrites the spry
validation at submit. Call on your cfform the validate() function
on submit action. You should have something like: if
(Spry.Widget.Form.validate(form) == true)....
On submit check if the validate() function returns true or
false. If true, continue submission, if false trigger the spry
validation.
Does anyone have a sample of the code, or more detailed
information on the code reffered to above. I have included my code
below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:spry="
http://ns.adobe.com/spry/">
<head>
<title>Admissions Application</title>
<cfinclude template="/head/app.htm" />
<script type="text/javascript">
<!--
function ValidateForm(form){
if(Spry.Widget.Form.validate(form)==true)
return true;
//-->
</script>
</head>
<body>
<div id="container" style="background-image:none;">
<div id="header">
<cfinclude template="/templates/header.htm" />
</div>
<img id="leafBottom" src="/images/rightNavLeaf.png"
alt="" />
<div id="content">
<cfform method="post" name="app" id="application"
action="" onsubmit="javascript:return ValidateForm(this)"
enctype="x-www-form-urlencoded">
<div id="box">
<h1>I.D. and Name Information</h1>
<p class="section">Section 1 of 7</p>
<h3>Social Security Number</h3>
<div id="thessn">
<label for="ssn"><span
class="required">*</span>Social Security
Number:</label>
<p><cfinput id="ssn" class="field" name="ssn"
type="text" size="10" />
<span class="textfieldRequiredMsg">Please enter your
social security number.</span>
<span class="textfieldInvalidFormatMsg">Please enter a
valid social security number.</span></p>
</div>
<div id="thessn2">
<label for="ssn2"><span
class="required">*</span>Re-enter Social Security
Number:</label>
<p><cfinput id="ssn2" class="field" name="ssn2"
type="text" size="10" />
<span class="textfieldRequiredMsg">Please re-enter
your social security number.</span>
<span class="textfieldInvalidFormatMsg">Please enter a
valid social security number.</span>
<span class="confirmInvalidMsg">Social Security
entires do not match.</span></p>
</div>
<p><cfinput class="field" type="submit" name=""
value="Submit Application" /></p>
</div>
</cfform>
<script type="text/javascript">
<!--
var thessn = new Spry.Widget.ValidationTextField("thessn",
"social_security_number", {isRequired:"true", validateOn:["change",
"blur"]});
var thessn2 = new Spry.Widget.ValidationTextField("thessn2",
"social_security_number", {isRequired:"true", validateOn:["change",
"blur"]});
var spryconfirm = new
Spry.Widget.ValidationConfirm("thessn2", "ssn");
//-->
</script>
</div>
<div id="footer">
<cfinclude template="/Templates/footer.htm" />
</div>
</div>
</body>
</html>if you use a cfform this normally overwrites the spry
validation at submit. Call on your cfform the validate() function
on submit action. You should have something like: if
(Spry.Widget.Form.validate(form) == true)....
On submit check if the validate() function returns true or
false. If true, continue submission, if false trigger the spry
validation.
Does anyone have a sample of the code, or more detailed
information on the code reffered to above. I have included my code
below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:spry="
http://ns.adobe.com/spry/">
<head>
<title>Admissions Application</title>
<cfinclude template="/head/app.htm" />
<script type="text/javascript">
<!--
function ValidateForm(form){
if(Spry.Widget.Form.validate(form)==true)
return true;
//-->
</script>
</head>
<body>
<div id="container" style="background-image:none;">
<div id="header">
<cfinclude template="/templates/header.htm" />
</div>
<img id="leafBottom" src="/images/rightNavLeaf.png"
alt="" />
<div id="content">
<cfform method="post" name="app" id="application"
action="" onsubmit="javascript:return ValidateForm(this)"
enctype="x-www-form-urlencoded">
<div id="box">
<h1>I.D. and Name Information</h1>
<p class="section">Section 1 of 7</p>
<h3>Social Security Number</h3>
<div id="thessn">
<label for="ssn"><span
class="required">*</span>Social Security
Number:</label>
<p><cfinput id="ssn" class="field" name="ssn"
type="text" size="10" />
<span class="textfieldRequiredMsg">Please enter your
social security number.</span>
<span class="textfieldInvalidFormatMsg">Please enter a
valid social security number.</span></p>
</div>
<div id="thessn2">
<label for="ssn2"><span
class="required">*</span>Re-enter Social Security
Number:</label>
<p><cfinput id="ssn2" class="field" name="ssn2"
type="text" size="10" />
<span class="textfieldRequiredMsg">Please re-enter
your social security number.</span>
<span class="textfieldInvalidFormatMsg">Please enter a
valid social security number.</span>
<span class="confirmInvalidMsg">Social Security
entires do not match.</span></p>
</div>
<p><cfinput class="field" type="submit" name=""
value="Submit Application" /></p>
</div>
</cfform>
<script type="text/javascript">
<!--
var thessn = new Spry.Widget.ValidationTextField("thessn",
"social_security_number", {isRequired:"true", validateOn:["change",
"blur"]});
var thessn2 = new Spry.Widget.ValidationTextField("thessn2",
"social_security_number", {isRequired:"true", validateOn:["change",
"blur"]});
var spryconfirm = new
Spry.Widget.ValidationConfirm("thessn2", "ssn");
//-->
</script>
</div>
<div id="footer">
<cfinclude template="/Templates/footer.htm" />
</div>
</div>
</body>
</html> -
if you use a cfform this normally overwrites the spry
validation at submit. Call on your cfform the validate() function
on submit action. You should have something like: if
(Spry.Widget.Form.validate(form) == true)....
On submit check if the validate() function returns true or
false. If true, continue submission, if false trigger the spry
validation.
Does anyone have a sample of the code, or more detailed
information on the code reffered to above. I have included my code
below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:spry="
http://ns.adobe.com/spry/">
<head>
<title>Admissions Application</title>
<cfinclude template="/head/app.htm" />
<script type="text/javascript">
<!--
function ValidateForm(form){
if(Spry.Widget.Form.validate(form)==true)
return true;
//-->
</script>
</head>
<body>
<div id="container" style="background-image:none;">
<div id="header">
<cfinclude template="/templates/header.htm" />
</div>
<img id="leafBottom" src="/images/rightNavLeaf.png" alt=""
/>
<div id="content">
<cfform method="post" name="app" id="application"
action="" onsubmit="javascript:return ValidateForm(this)"
enctype="x-www-form-urlencoded">
<div id="box">
<h1>I.D. and Name Information</h1>
<p class="section">Section 1 of 7</p>
<h3>Social Security Number</h3>
<div id="thessn">
<label for="ssn"><span
class="required">*</span>Social Security
Number:</label>
<p><cfinput id="ssn" class="field" name="ssn"
type="text" size="10" />
<span class="textfieldRequiredMsg">Please enter your
social security number.</span>
<span class="textfieldInvalidFormatMsg">Please enter a
valid social security number.</span></p>
</div>
<div id="thessn2">
<label for="ssn2"><span
class="required">*</span>Re-enter Social Security
Number:</label>
<p><cfinput id="ssn2" class="field" name="ssn2"
type="text" size="10" />
<span class="textfieldRequiredMsg">Please re-enter your
social security number.</span>
<span class="textfieldInvalidFormatMsg">Please enter a
valid social security number.</span>
<span class="confirmInvalidMsg">Social Security entires
do not match.</span></p>
</div>
<p><cfinput class="field" type="submit" name=""
value="Submit Application" /></p>
</div>
</cfform>
<script type="text/javascript">
<!--
var thessn = new Spry.Widget.ValidationTextField("thessn",
"social_security_number", {isRequired:"true", validateOn:["change",
"blur"]});
var thessn2 = new Spry.Widget.ValidationTextField("thessn2",
"social_security_number", {isRequired:"true", validateOn:["change",
"blur"]});
var spryconfirm = new
Spry.Widget.ValidationConfirm("thessn2", "ssn");
//-->
</script>
</div>
<div id="footer">
<cfinclude template="/Templates/footer.htm" />
</div>
</div>
</body>
</html>Thanks for pointing this out...
Yes! as per the cfinput tag, type=text and not textbox
Reference: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f 51.html
We will get this fixed!! -
cflayout , cfform , cfif - not working right
Greetings,
CF Ver: 8,0,1,195765
<cfajaximport tags="cflayout-tab,cfform,cftooltip">
DW CS5
<cflayoutarea source="resource_upload.cfm"
Form elements are:
-- res_type = radio
-- res_yy = text
-- res_title = text
-- res_doc = file
I have a form embedded in a tab of a <cflayout>. The form works fine
external to the <cflayout>. When I say it works fine, I mean that
when the form fields are evaluated for emptiness with <cfif>(s) all
processes as expected.
However, when I embed the form inside the <cflayout> the <cffile>
form field no longer evaluates properly for emptiness. Whether the
field is empty or not, it always processes as if there is content in it.
I have even tried setting a variable using <cfparam> and still cannot
get it to evaluate as it does outside the <cflayout>. I have also used
the len and trim functions as well performing the evaluations.
Is there something I am missing to make the form function inside the
<cflayout> as it does outside of it?
Thanks in advance.
Leonard BHey Adam,
Below is the code that I am working with.
================================
<!--- The cflayout --->
<div align="center">
<div style="clear: both; padding: 25px 0px 0px 0px; width: 600px" align="left">
<div style="border: 5px solid #900">
<cflayout type="tab" align="left" name="resource_management" tabposition="top" style="margin-top: -3px">
<cflayoutarea name="resource_upload" overflow="auto" style="background-color: ##FC0; height: 400px;" title="Resource Upload">
<div style="clear: both; padding: 10px 10px 10px 10px">
<cfform action="insert_resource_upload_processing.cfm" target="resource_upload" method="post" enctype="multipart/form-data" name="form_01" id="form_01" class="formBody" lang="en" dir="ltr" xml:lang="en">
<div style="clear: both; float: left; padding: 0px 10px 0px 0px">
<label for="resource_yy" class="formLabel"> YEAR</label><br />
<cfinput type="text" name="resource_yy" class="formInput" id="resource_yy" style="text-align: center; width: 50px;" dir="ltr" lang="en" typeahead="no" showautosuggestloadingicon="true">
</div>
<div style="float: left">
<label for="resource_grp" class="formLabel"> RESOURCE GROUP</label><br />
<cfselect enabled="No" name="resource_grp" size="1" class="formSelect" id="resource_grp" dir="ltr" lang="en" multiple="no">
<option value="None" selected="selected">- Select Group -</option>
<option value="Tests">Tests / Answer Keys</option>
<option value="Digests">Digests</option>
<option value="PowerPoints">PowerPoints</option>
<option value="Other Documents">Other Documents</option>
</cfselect>
</div>
<div style="clear: both; padding: 10px 0px 0px 0px">
<label for="resource_title" class="formLabel"> RESOURCE TITLE</label><br />
<cfinput type="text" name="resource_title" class="formInput" id="resource_title" style="width: 565px;" dir="ltr" lang="en" typeahead="no" showautosuggestloadingicon="true">
</div>
<div style="clear: both; padding: 10px 0px 0px 0px">
<label for="resource_pwrpnt" class="formLabel"> RESOURCE POWERPOINT</label><br />
<cfinput type="file" name="resource_pwrpnt" class="formFile" id="resource_pwrpnt" dir="ltr" lang="en" size="78" xml:lang="en">
</div>
<div style="clear: both; padding: 10px 0px 0px 0px">
<div style="float: left; padding: 0px 10px 0px 0px">
<cfinput type="submit" name="btn_post" class="buttonSubmit" id="btn_post" style="letter-spacing: 1px; width: 125px;" dir="ltr" lang="en" value="POST RESOURCE"></div>
<div style="float: left">
<cfinput type="reset" name="btn_clear" class="buttonReset" id="btn_clear" style="letter-spacing: 1px; width: 125px;" dir="ltr" lang="en" value="CLEAR FIELDS"></div>
</div>
</cfform>
</div>
</cflayoutarea>
<cflayoutarea name="resource_delete" overflow="auto" style="background-color: ##CC9; height: 400px;" title="Resource Delete">
<p>Content tab 2 here</p>
</cflayoutarea>
</cflayout>
</div>
</div>
</div>
<!--- The action page --->
<cfparam name="form.resource_pwrpnt" default="None">
<p>
<cfif isdefined('form.resource_yy') and trim(form.resource_yy) eq "">
Year Resource year not provided<br />
<cfelse>
Year <cfoutput>#form.resource_yy#</cfoutput>
</cfif></p>
<p>
<cfif isdefined('form.resource_grp') and trim(form.resource_grp) eq "None">
Group: Resource group not provided<br />
<cfelse>
Group: <cfoutput>#form.resource_grp#</cfoutput>
</cfif></p>
<p>
<cfif isdefined('form.resource_title') and trim(form.resource_title) eq "">
Title Rescource title not provided
<cfelse>
Title <cfoutput>#form.resource_title#</cfoutput>
</cfif></p>
<p>
<cfif isdefined('form.resource_pwrpnt') and trim(form.resource_pwrpnt) eq "">
PwrPnt Resource powerpoint not provided
<cfelse>
PwrPnt <cfoutput>#form.resource_pwrpnt#</cfoutput>
</cfif></p>
<div style="clear: both; padding: 5px 0px 0px 0px">
<cfform action="insert_resource_upload_form.cfm" method="post" enctype="multipart/form-data" name="form_01" id="form_01" class="formBody" lang="en" dir="ltr">
<cfinput type="submit" name="btn_prev_01" class="buttonGoback" id="btn_prev_01" style="letter-spacing: 1px; width: 135px;" dir="ltr" lang="en" value="PREVIOUS SCREEN" xml:lang="en">
</cfform>
</div>
Maybe you are looking for
-
Does an Iphone with mophie juice pack plus fit in the tigra bike mount?
Does an Iphone with mophie juice pack plus fit in the tigra bike mount?
-
Hello! I bought CC on monthly payments for 2 computers and going to buy another 2. On the first computer is good, but the second I can only press trial button or license button. But the license key I do not have? Where can I get the key? How do I ge
-
I have an "iTunes Library.itl cannot be read" error after downloading IOS7. HELP!
I have an "iTunes Library.itl cannot be read" error after downloading IOS7. HELP!
-
Revision: 16514 Revision: 16514 Author: [email protected] Date: 2010-06-09 16:09:18 -0700 (Wed, 09 Jun 2010) Log Message: Initial push of all projects for Zeri Certification Tests. Added Paths: osmf/branches/zeri-certification/Tes
-
I cant get iPhoto on my second hand macbook air
can anybody tell me or provide me how can i get i photo free easily on my macbook air. its second hand i tried 100sss iam tired