XWeb: Individual HTML ColdFusion Sample

ColdFusion makes it very easy to integrate with web services. One of the most common requirements an organization has is the need to insert and update a variety of member information. Most often, this includes individual's addresses, phone numbers, fax numbers, and e-mail addresses.

The code provided below is an example of how HTML, ColdFusion, and xWeb can be used to display an individual's general information.

Assumptions

In order to use the code provided below, you will need to have successfully implemented the various web methods using the xWeb: ColdFusion required core ColdFusion component xWeb for xWeb.

Sample Code

<style type="text/css">
h4 {
font-family:Tahoma,Tresbuchet MS,Arial;
font-size:12px;
text-align:center;
width:600px;
position:absolute;
background-color:#FFFFFF;
z-index:-1;
}
h5 {
font-family:Tahoma,Tresbuchet MS,Arial;
font-size:9px;
width:600px;
text-align:center;
z-index:-1;
}
</style>
<script language="javascript" type="text/javascript">
//////////////////
// popup window //
//////////////////
var features="status=no,scrollbars=yes,resizable=yes,menubar=yes,width=650,height=445,top=25,left=25";
function Info(x){
//window.name = "AddEditDeleteWindow";
var openit = window.open(x, "AddEditDeleteWindow", features);
}
 
</script>
<!--- xweb_Authenticate : Initialize --->
<h4>Retreiving Member Information<br />
<img src="../images/loading.gif" alt="loading" width="35" height="35" hspace="0" vspace="0" border="0" style="z-index:-1;" /><br />
</h4>
<cfflush>
<cftry>
<cfinvoke component="/gateway/netforum_xweb" method="xweb_Authenticate" returnvariable="nfws_token">
<cfinvokeargument name="uname" value="#application.nfws_uname#" omit="no">
<cfinvokeargument name="pword" value="#application.nfws_pword#" omit="no">
</cfinvoke>
<cfcatch type="any">
<h4>Unable to connect to the web service gateway.</h4>
<cfflush>
<cfabort>
</cfcatch>
</cftry>
 
<!--- xweb_GetQuery : Customer --->
<cfinvoke component="/gateway/netforum_xweb" method="xweb_GetQuery" returnvariable="nfws_result">
<cfinvokeargument name="nfws_namespace" value="#application.nfws_namespace#" omit="no">
<cfinvokeargument name="nfws_address" value="#application.nfws_address#" omit="no">
<cfinvokeargument name="nfws_token" value="#session.nfws_token#" omit="no">
<cfinvokeargument name="szObjectName" value="Customer" omit="no">
<cfinvokeargument name="szColumnList" value="cst_key" omit="no">
<cfinvokeargument name="szWhereClause" value="cst_key='#session.cst_key#'" omit="no">
<cfinvokeargument name="szOrderBy" value="" omit="no">
</cfinvoke>
<cfoutput query="nfws_result" maxrows="1">
<cfset session.cst_key = cst_key>
</cfoutput>
 
<!--- xweb_GetIndividualInformation --->
<cfinvoke component="/gateway/netforum_xweb" method="xweb_GetIndividualInformation" returnvariable="qryIndividual">
<cfinvokeargument name="nfws_namespace" value="#application.nfws_namespace#" omit="no">
<cfinvokeargument name="nfws_address" value="#application.nfws_address#" omit="no">
<cfinvokeargument name="nfws_token" value="#session.nfws_token#" omit="no">
<cfinvokeargument name="cst_key" value="#session.cst_key#" omit="no">
</cfinvoke>
 
<!--- xweb_GetFacadeObject : Customer --->
<cfinvoke component="/gateway/netforum_xweb" method="xweb_GetFacadeObject" returnvariable="qryCustomerPrimary">
<cfinvokeargument name="nfws_namespace" value="#application.nfws_namespace#" omit="no">
<cfinvokeargument name="nfws_address" value="#application.nfws_address#" omit="no">
<cfinvokeargument name="nfws_token" value="#session.nfws_token#" omit="no">
<cfinvokeargument name="szObjectName" value="Customer" omit="no">
<cfinvokeargument name="szObjectKey" value="#session.cst_key#" omit="no">
</cfinvoke>
 
<!--- xweb_GetQuery - IndividualAddress --->
<h4>Retreiving Address Information.</h4>
<cfflush>
<cftry>
<cfinvoke component="/gateway/netforum_xweb" method="xweb_GetQuery" returnvariable="qryIndividualAddress">
<cfinvokeargument name="nfws_namespace" value="#application.nfws_namespace#" omit="no">
<cfinvokeargument name="nfws_address" value="#application.nfws_address#" omit="no">
<cfinvokeargument name="nfws_token" value="#session.nfws_token#" omit="no">
<cfinvokeargument name="szObjectName" value="IndividualAddress" omit="no">
<cfinvokeargument name="szColumnList" value="" omit="no">
<cfinvokeargument name="szWhereClause" value="cxa_cst_key='#session.cst_key#' AND cxa_delete_flag=0" omit="no">
<cfinvokeargument name="szOrderBy" value="" omit="no">
</cfinvoke>
<cfcatch type="any">
<cfscript>
qryIndividualAddress = QueryNew("adr_key");
newRow = QueryAddRow(qryIndividualAddress,1);
temp = QuerySetCell(qryIndividualAddress, "adr_key", "", 1);
</cfscript>
</cfcatch>
</cftry>
 
<!--- xweb_GetQuery - IndividualPhone --->
<h4>Retreiving Phone, Fax, and E-Mail Information.</h4>
<cfflush>
<cftry>
<cfinvoke component="/gateway/netforum_xweb" method="xweb_GetQuery" returnvariable="qryIndividualPhone">
<cfinvokeargument name="nfws_namespace" value="#application.nfws_namespace#" omit="no">
<cfinvokeargument name="nfws_address" value="#application.nfws_address#" omit="no">
<cfinvokeargument name="nfws_token" value="#session.nfws_token#" omit="no">
<cfinvokeargument name="szObjectName" value="IndividualPhone" omit="no">
<cfinvokeargument name="szColumnList" value="" omit="no">
<cfinvokeargument name="szWhereClause" value="cph_cst_key='#session.cst_key#' AND cph_delete_flag=0" omit="no">
<cfinvokeargument name="szOrderBy" value="" omit="no">
</cfinvoke>
<cfcatch type="any">
<cfscript>
qryIndividualPhone = QueryNew("cph_key");
newRow = QueryAddRow(qryIndividualPhone,1);
temp = QuerySetCell(qryIndividualPhone, "cph_key", "", 1);
</cfscript>
</cfcatch>
</cftry>
 
<!--- xweb_GetQuery - IndividualFax --->
<cftry>
<cfinvoke component="/gateway/netforum_xweb" method="xweb_GetQuery" returnvariable="qryIndividualFax">
<cfinvokeargument name="nfws_namespace" value="#application.nfws_namespace#" omit="no">
<cfinvokeargument name="nfws_address" value="#application.nfws_address#" omit="no">
<cfinvokeargument name="nfws_token" value="#session.nfws_token#" omit="no">
<cfinvokeargument name="szObjectName" value="IndividualFax" omit="no">
<cfinvokeargument name="szColumnList" value="" omit="no">
<cfinvokeargument name="szWhereClause" value="cfx_cst_key='#session.cst_key#' AND cfx_delete_flag=0" omit="no">
<cfinvokeargument name="szOrderBy" value="" omit="no">
</cfinvoke>
<cfcatch type="any">
<cfscript>
qryIndividualFax = QueryNew("cfx_key,");
newRow = QueryAddRow(qryIndividualFax,1);
temp = QuerySetCell(qryIndividualFax, "cfx_key", "", 1);
</cfscript>
</cfcatch>
</cftry>
 
<!--- xweb_GetQuery - IndividualEmail --->
<cftry>
<cfinvoke component="/gateway/netforum_xweb" method="xweb_GetQuery" returnvariable="qryIndividualEmail">
<cfinvokeargument name="nfws_namespace" value="#application.nfws_namespace#" omit="no">
<cfinvokeargument name="nfws_address" value="#application.nfws_address#" omit="no">
<cfinvokeargument name="nfws_token" value="#session.nfws_token#" omit="no">
<cfinvokeargument name="szObjectName" value="IndividualEmail" omit="no">
<cfinvokeargument name="szColumnList" value="" omit="no">
<cfinvokeargument name="szWhereClause" value="eml_cst_key='#session.cst_key#' AND eml_delete_flag=0" omit="no">
<cfinvokeargument name="szOrderBy" value="" omit="no">
</cfinvoke>
<cfcatch type="any">
<cfscript>
qryIndividualEmail = QueryNew("eml_key");
newRow = QueryAddRow(qryIndividualEmail,1);
temp = QuerySetCell(qryIndividualEmail, "eml_key", "", 1);
</cfscript>
</cfcatch>
</cftry>
 
<!---
<cfdump var="#qryIndividual#" label="Customer"><br />
<cfdump var="#qryIndividualAddress#" label="Address"><br />
<cfdump var="#qryIndividualPhone#" label="Phone"><br />
<cfdump var="#qryIndividualFax#" label="Fax"><br />
<cfdump var="#qryIndividualEmail#" label="Email"><br />
<cfabort>
--->
 
<div style="width:600px; background-color:white;">
<br />
<cfform action="#replace(cgi.script_name,'_form','_action','all')#" method="post" id="upd">
<cfoutput query="qryCustomerPrimary">
<strong>#cst_ind_full_name_dn#</strong>
<cfinput type="hidden" name="cst_key" value="#trim(cst_key)#" />
<cfinput type="hidden" name="cst_type" value="#trim(cst_type)#" />
<cfinput type="hidden" name="adr_key" value="#trim(adr_key)#" />
 
<table width="100%">
<tr><td colspan="3" align="right">
<cfinput type="submit" name="btn_update" value="UPDATE" />
<cfinput type="submit" name="btn_cancel" value="CANCEL" />
<cfinput type="reset" name="btn_reset" value="RESET" />
</td></tr>
</table>
 
<!-- ind -->
<strong>Full Name</strong>
<div style="margin:0px; padding:10px; border:1px black solid;">
<table>
<cfloop query="qryIndividual" endrow="1">
<tr><td valign="top">
<small>First Name:</small><br />
<cfinput type="text" name="ind_first_name" value="#ind_first_name#" size="15" title="Update the user's first name." validate="noblanks" required="yes" message="The user's first name cannot be blank."><br />
</td><td valign="top">
<small>Middle Initial:</small><br />
<cfinput type="text" name="ind_mid_name" value="#ind_mid_name#" size="15" title="Update the user's middle initial." required="no" message=""><br />
</td><td valign="top">
<small>Last Name:</small><br />
<cfinput type="text" name="ind_last_name" value="#ind_last_name#" size="35" title="Update the user's last name." validate="noblanks" required="yes" message="The user's first name cannot be blank."><br />
</td></tr>
</cfloop>
</table>
</div>
<br />
 
<!--- Mailing Addresses --->
<div style="float:right;"><a href="javascript: void(0);" onclick="Info('updateMembers_form_popup_address-enter.cfm');"><img src="../images/icon_enter.gif" alt="enter" style="position:relative; top:7px;" width="59" height="18" hspace="5" vspace="0" border="0" /></a><br /></div>
<strong>Mailing Addresses:</strong>
<div style="margin:0px; padding:10px; border:1px black solid;">
<table cellpadding="2" cellspacing="0" border="0">
<cfloop query="qryIndividualAddress">
<cfif currentrow mod 2>
<cfset row_bgcolor="EBEBEB">
<cfelse>
<cfset row_bgcolor="FFFFFF">
</cfif>
<cfset row_styles="border-top:1px solid ##1E7BB8; padding:3px;">
<tr style="background-color:###row_bgcolor#;#row_styles#"><td valign="top">
<a href="javascript: void(0);" onclick="Info('updateMembers_form_popup_address-edit.cfm?cxa_key=#cxa_key#');"><img src="../images/icon_update.gif" alt="update/delete" width="59" height="18" hspace="5" vspace="0" border="0" /></a><br />
</td><td width="100%" valign="top">
#adr_line1#<br />
<cfif adr_line2 IS NOT "">#adr_line2#<br /></cfif>
<cfif adr_line3 IS NOT "">#adr_line3#<br /></cfif>
#adr_city#, #adr_state# #adr_post_code#<br />
<span style="font-size:smaller;">#adr_country#</span><br />
</td></tr>
</cfloop>
</table>
</div>
<br />
 
<!--- Phone Numbers --->
<div style="float:right;"><a href="javascript: void(0);" onclick="Info('updateMembers_form_popup_phone-enter.cfm');"><img src="../images/icon_enter.gif" alt="enter" style="position:relative; top:7px;" width="59" height="18" hspace="5" vspace="0" border="0" /></a><br /></div>
<strong>Phone Numbers:</strong>
<div style="margin:0px; padding:10px; border:1px black solid;">
<table cellpadding="2" cellspacing="0" border="0">
<cfset cph_count = 0>
<cfloop query="qryIndividualPhone">
<cfset cph_count = cph_count + 1>
<cfif currentrow mod 2>
<cfset row_bgcolor="EBEBEB">
<cfelse>
<cfset row_bgcolor="FFFFFF">
</cfif>
<cfset row_styles="border-top:1px solid ##1E7BB8; padding:3px;">
<tr style="background-color:###row_bgcolor#;#row_styles#"><td valign="top">
<a href="javascript: void(0);" onclick="Info('updateMembers_form_popup_phone-edit.cfm?cph_key=#cph_key#');"><img src="../images/icon_update.gif" alt="update/delete" width="59" height="18" hspace="5" vspace="0" border="0" /></a><br />
</td><td width="100%" valign="top">
#phn_number_display#
<cfif cph_extension IS NOT "">ext. #cph_extension#</cfif>
<cfif cst_cph_key EQ cph_key><small>(primary)</small></cfif>
<cfif cph_unlisted_flag> <small style="color:##009900;">unlisted</small> </cfif>
<br />
</td></tr>
</cfloop>
</table>
<cfif cph_count EQ 0>
<small>
No phone numbers are on file for this individual.<br />
</small>
</cfif>
</div>
<br />
 
<!--- Fax Numbers --->
<div style="float:right;"><a href="javascript: void(0);" onclick="Info('updateMembers_form_popup_fax-enter.cfm');"><img src="../images/icon_enter.gif" alt="enter" style="position:relative; top:7px;" width="59" height="18" hspace="5" vspace="0" border="0" /></a><br /></div>
<strong>Fax Numbers:</strong>
<div style="margin:0px; padding:10px; border:1px black solid;">
<table cellpadding="2" cellspacing="0" border="0">
<cfset fax_count = 0>
<cfloop query="qryIndividualFax">
<cfset fax_count = fax_count + 1>
<cfif currentrow mod 2>
<cfset row_bgcolor="EBEBEB">
<cfelse>
<cfset row_bgcolor="FFFFFF">
</cfif>
<cfset row_styles="border-top:1px solid ##1E7BB8; padding:3px;">
<tr style="background-color:###row_bgcolor#;#row_styles#"><td valign="top">
<a href="javascript: void(0);" onclick="Info('updateMembers_form_popup_fax-edit.cfm?cfx_key=#cfx_key#');"><img src="../images/icon_update.gif" alt="update/delete" width="59" height="18" hspace="5" vspace="0" border="0" /></a><br />
</td><td width="100%" valign="top">
#fax_number_display#
<cfif cfx_extension IS NOT "">ext. #cfx_extension#</cfif>
<cfif cst_cfx_key EQ cfx_key><small>(primary)</small></cfif>
<cfif cfx_unlisted_flag> <small style="color:##009900;">unlisted</small> </cfif>
<br />
</td></tr>
</cfloop>
</table>
<cfif fax_count EQ 0>
<small>
No fax numbers are on file for this individual.<br />
</small>
</cfif>
</div>
<br />
 
<!--- E-Mail Addresses --->
<div style="float:right;"><a href="javascript: void(0);" onclick="Info('updateMembers_form_popup_email-enter.cfm');"><img src="../images/icon_enter.gif" alt="enter" style="position:relative; top:7px;" width="59" height="18" hspace="5" vspace="0" border="0" /></a><br /></div>
<strong>E-Mail Addresses:</strong>
<div style="margin:0px; padding:10px; border:1px black solid;">
<table cellpadding="2" cellspacing="0" border="0">
<cfset eml_count = 0>
<cfloop query="qryIndividualEmail">
<cfset eml_count = eml_count + 1>
<cfif currentrow mod 2>
<cfset row_bgcolor="EBEBEB">
<cfelse>
<cfset row_bgcolor="FFFFFF">
</cfif>
<cfset row_styles="border-top:1px solid ##1E7BB8; padding:3px;">
<tr style="background-color:###row_bgcolor#;#row_styles#"><td valign="top">
<a href="javascript: void(0);" onclick="Info('updateMembers_form_popup_email-edit.cfm?eml_key=#eml_key#');"><img src="../images/icon_update.gif" alt="update/delete" width="59" height="18" hspace="5" vspace="0" border="0" /></a><br />
</td><td width="100%" valign="top">
#eml_address#<br />
</td></tr>
</cfloop>
</table>
<cfif eml_count EQ 0>
<small>
No e-mail addresses are on file for this individual.<br />
</small>
</cfif>
</div>
<br />
</cfoutput>

See Also