CFInsert Form (Success Message)

View: New views
7 Messages — Rating Filter:   Alert me  

CFInsert Form (Success Message)

by Barry Mcconaghey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello.

I have a form on my website:

<cfquery name="States" datasource="#request.dsn#" username="#request.un#" password="#request.pw#">
SELECT statecodeID, statename
FROM states
</cfquery>

<cfselect name="statecodeID" size="1" class="input-text">
            <cfoutput query="States">
                <option value="#statecodeID#">#statename#</option>
            </cfoutput>
</cfselect>

When a user submits this form, a number for the statename is entered into the database. For example: Florida is 34.

I want to display on my cfform action page the statename not the number from the form.

The cfform action page now:

<cfoutput>
State - #FORM.statecodeid#
</cfoutput>

Display Message Now:

State - 34

I want it to display:

State - Florida

Thanks,

Barry


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4790
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

RE: CFInsert Form (Success Message)

by Paul Kukiel-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Barry,


Use this:

<cfselect name="statecodeID" size="1" class="input-text">
            <cfoutput query="States">
                <option value="#statename#">#statename#</option>
            </cfoutput>
</cfselect>

Paul.

-----Original Message-----
From: Barry Mcconaghey [mailto:bmcconaghey@...]
Sent: Sunday, August 30, 2009 10:34 AM
To: cf-newbie
Subject: CFInsert Form (Success Message)


Hello.

I have a form on my website:

<cfquery name="States" datasource="#request.dsn#" username="#request.un#"
password="#request.pw#">
SELECT statecodeID, statename
FROM states
</cfquery>

<cfselect name="statecodeID" size="1" class="input-text">
            <cfoutput query="States">
                <option value="#statecodeID#">#statename#</option>
            </cfoutput>
</cfselect>

When a user submits this form, a number for the statename is entered into
the database. For example: Florida is 34.

I want to display on my cfform action page the statename not the number from
the form.

The cfform action page now:

<cfoutput>
State - #FORM.statecodeid#
</cfoutput>

Display Message Now:

State - 34

I want it to display:

State - Florida

Thanks,

Barry




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4791
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

RE: CFInsert Form (Success Message)

by Misha Mishyn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


One of the method it can be done:

****************************************************************************
*************************
<cfquery name="States" datasource="#request.dsn#" username="#request.un#"
password="#request.pw#">
        SELECT statecodeID, statename
        FROM states
</cfquery>

<cfselect name="statecodeID" size="1" class="input-text">
          <cfoutput query="States">
                <option value="#statecodeID#">#statename#</option>
            </cfoutput>
</cfselect>


<cfif IsDefined('form.statecodeID ') AND form.statecodeID GT 0>

        <cfquery name="qry" dbtype="query">
                SELECT statecodeID, statename
                FROM States
                WHERE statecodeID = <cfqueryparam value="#form.statecodeID
#" type="cf_sql_int">
        </cfquery>

        <cfoutput>
                State - #qry.statename#
        </cfoutput>
</cfif>
****************************************************************************
***********************


Regards,
Misha


-----Original Message-----
From: Barry Mcconaghey [mailto:bmcconaghey@...]
Sent: Sunday, August 30, 2009 10:34 AM
To: cf-newbie
Subject: CFInsert Form (Success Message)


Hello.

I have a form on my website:

<cfquery name="States" datasource="#request.dsn#" username="#request.un#"
password="#request.pw#">
SELECT statecodeID, statename
FROM states
</cfquery>

<cfselect name="statecodeID" size="1" class="input-text">
            <cfoutput query="States">
                <option value="#statecodeID#">#statename#</option>
            </cfoutput>
</cfselect>

When a user submits this form, a number for the statename is entered into
the database. For example: Florida is 34.

I want to display on my cfform action page the statename not the number from
the form.

The cfform action page now:

<cfoutput>
State - #FORM.statecodeid#
</cfoutput>

Display Message Now:

State - 34

I want it to display:

State - Florida

Thanks,

Barry




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4792
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

Re: CFInsert Form (Success Message)

by Barry Mcconaghey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Paul.

I do not want to change my website forms because I have thousands on entries. I want to build a new cfform action page.

Thanks,

Barry

>Hi Barry,
>
>
>Use this:
>
><cfselect name="statecodeID" size="1" class="input-text">
>            <cfoutput query="States">
>                <option value="#statename#">#statename#</option>
>            </cfoutput>
></cfselect>
>
>Paul.
>
>Hello.
>
>I have a form on my website:
>
><cfquery name="States" datasource="#request.dsn#" username="#request.un#"
>password="#request.pw#">
>SELECT statecodeID, statename
>FROM states
></cfquery>
>
><cfselect name="statecodeID" size="1" class="input-text">
>            <cfoutput query="States">
>                <option value="#statecodeID#">#statename#</option>
>            </cfoutput>
></cfselect>
>
>When a user submits this form, a number for the statename is entered into
>the database. For example: Florida is 34.
>
>I want to display on my cfform action page the statename not the number from
>the form.
>
>The cfform action page now:
>
><cfoutput>
>State - #FORM.statecodeid#
></cfoutput>
>
>Display Message Now:
>
>State - 34
>
>I want it to display:
>
>State - Florida
>
>Thanks,
>
>Barry

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4793
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

Re: CFInsert Form (Success Message)

by Barry Mcconaghey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Misha.

I added your code but I got an error message:

 Attribute validation error for tag CFQUERYPARAM.
The tag does not allow the attribute(s) TYPE. The valid attribute(s) are CFSQLTYPE,LIST,MAXLENGTH,NULL,SCALE,SEPARATOR,VALUE.

Barry

>One of the method it can be done:
>
>****************************************************************************
>*************************
><cfquery name="States" datasource="#request.dsn#" username="#request.un#"
>password="#request.pw#">
> SELECT statecodeID, statename
> FROM states
></cfquery>
>
><cfselect name="statecodeID" size="1" class="input-text">
>          <cfoutput query="States">
>                <option value="#statecodeID#">#statename#</option>
>            </cfoutput>
></cfselect>
>
>
><cfif IsDefined('form.statecodeID ') AND form.statecodeID GT 0>
>
> <cfquery name="qry" dbtype="query">
> SELECT statecodeID, statename
> FROM States
> WHERE statecodeID = <cfqueryparam value="#form.statecodeID
>#" type="cf_sql_int">
> </cfquery>
>
> <cfoutput>
> State - #qry.statename#
> </cfoutput>
></cfif>
>****************************************************************************
>***********************
>
>
>Regards,
>Misha
>
>
>Hello.
>
>I have a form on my website:
>
><cfquery name="States" datasource="#request.dsn#" username="#request.un#"
>password="#request.pw#">
>SELECT statecodeID, statename
>FROM states
></cfquery>
>
><cfselect name="statecodeID" size="1" class="input-text">
>            <cfoutput query="States">
>                <option value="#statecodeID#">#statename#</option>
>            </cfoutput>
></cfselect>
>
>When a user submits this form, a number for the statename is entered into
>the database. For example: Florida is 34.
>
>I want to display on my cfform action page the statename not the number from
>the form.
>
>The cfform action page now:
>
><cfoutput>
>State - #FORM.statecodeid#
></cfoutput>
>
>Display Message Now:
>
>State - 34
>
>I want it to display:
>
>State - Florida
>
>Thanks,
>
>Barry

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4794
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

RE: CFInsert Form (Success Message)

by Paul Kukiel-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


OK then use Misha's example there is a small typo:

Change:
<cfqueryparam value="#form.statecodeID>#" type="cf_sql_int">

to

<cfqueryparam value="#form.statecodeID>#" cfsqltype="cf_sql_int">

Paul.


-----Original Message-----
From: Barry Mcconaghey [mailto:bmcconaghey@...]
Sent: Sunday, August 30, 2009 11:15 AM
To: cf-newbie
Subject: Re: CFInsert Form (Success Message)


Hi Misha.

I added your code but I got an error message:

 Attribute validation error for tag CFQUERYPARAM.
The tag does not allow the attribute(s) TYPE. The valid attribute(s) are
CFSQLTYPE,LIST,MAXLENGTH,NULL,SCALE,SEPARATOR,VALUE.

Barry

>One of the method it can be done:
>
>***************************************************************************
*

>*************************
><cfquery name="States" datasource="#request.dsn#" username="#request.un#"
>password="#request.pw#">
> SELECT statecodeID, statename
> FROM states
></cfquery>
>
><cfselect name="statecodeID" size="1" class="input-text">
>          <cfoutput query="States">
>                <option value="#statecodeID#">#statename#</option>
>            </cfoutput>
></cfselect>
>
>
><cfif IsDefined('form.statecodeID ') AND form.statecodeID GT 0>
>
> <cfquery name="qry" dbtype="query">
> SELECT statecodeID, statename
> FROM States
> WHERE statecodeID = <cfqueryparam value="#form.statecodeID
>#" type="cf_sql_int">
> </cfquery>
>
> <cfoutput>
> State - #qry.statename#
> </cfoutput>
></cfif>
>***************************************************************************
*

>***********************
>
>
>Regards,
>Misha
>
>
>Hello.
>
>I have a form on my website:
>
><cfquery name="States" datasource="#request.dsn#" username="#request.un#"
>password="#request.pw#">
>SELECT statecodeID, statename
>FROM states
></cfquery>
>
><cfselect name="statecodeID" size="1" class="input-text">
>            <cfoutput query="States">
>                <option value="#statecodeID#">#statename#</option>
>            </cfoutput>
></cfselect>
>
>When a user submits this form, a number for the statename is entered into
>the database. For example: Florida is 34.
>
>I want to display on my cfform action page the statename not the number
from

>the form.
>
>The cfform action page now:
>
><cfoutput>
>State - #FORM.statecodeid#
></cfoutput>
>
>Display Message Now:
>
>State - 34
>
>I want it to display:
>
>State - Florida
>
>Thanks,
>
>Barry



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4795
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

Re: CFInsert Form (Success Message)

by Barry Mcconaghey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks Paul!

Perfect.





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4796
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15