EasyCFM.COM ColdFusion Forums / ColdFusion Applications / Can't update my Flash form

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Can't update my Flash form

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

raym444
06-11-2007 @ 1:46 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 14
Joined: Apr 2006

I'm obviously overlooking something very simple since I can't seem to find anyone having this exact problem. I have a Flash form on my CF page that uses a <cfselect> to select a client from the drop down list. I also have a <cfif> statement that tells you your selection and displays a button once a selection is made. Everything seems to work fine when the form first loads, but when a selection is made from the drop down list, nothing happens. I've tried to use the onClick=this.form.submit() feature, but I just get an error saying "There is no method with the name 'form'." The code for this form follows. I've found numerous posts on the web that address other OnClick requests in a Flash form, but nothing about updating the current form with the selection in the drop down list that would allow my <cfif> statement to activate. It's been driving me nuts for days now so any help would be greatly appreciated.

Here's the forms code:

<cfform name="frmselectpayments" preservedata="yes" action="selectclientpayments.cfm?" method="post" height="258" width="360" format="flash" skin="haloblue">

    <cfformgroup type="panel" id="panel" height="220" width="350" label="Select client to view payments for." style="headerColors:##8ED1F9, ##F2F5F7; marginTop:0; marginBottom:0; fontSize:12; font-style:normal; text-align:center; headerHeight:35; cornerRadius:12; panelBorderStyle:'roundCorners'">
          <cfformitem type="spacer" height="30" />
          <cfformgroup type="vertical">
          <cfformgroup type="horizontal">
               <cfformitem type="spacer" width="20" />
               
                    <cfselect name="lClients" size="1" style="text-align:left" message="You must select a Client to continue." multiple="No" width="250" onChange="this.form.submit()"><option>------------- Select a Client -------------</option>
                    <cfloop query="qClientPayments">
                 <option value="#ClientID#" <cfif isDefined('form.lClients')><cfif form.lClients eq "#ClientID#">selected</cfif></cfif>><cfoutput>#ClientID# - #CustomerName#</cfoutput></option>
                    </cfloop>
                    </cfselect>               
                    
          </cfformgroup>
     <cfformitem type="spacer" height="40" />
          </cfformgroup>
          <cfformgroup type="horizontal">
                    
          <cfif isDefined('form.lClients')>
          <cfquery name="qClient" datasource="#Application.Datasource#">
          SELECT ClientID, CustomerName
          FROM tblClients
          WHERE ClientID='#form.lClients#'
          </cfquery>                    
               <cfformitem type="spacer" width="85" />
               <cfformitem type="html" style="font-size:18px; font-weight:bold; font:##003366">You have selected <cfoutput>#qClient.ClientID# (#qClient.ClientName#)</cfoutput></cfformitem>
               <cfinput name="Payments" type="button" width="150" value="View Payments" onClick="">               
          </cfif>
          
          </cfformgroup>
          </cfformgroup>     
</cfform>

kicker
06-11-2007 @ 5:05 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 717
Joined: Oct 2004

Why not use remoting to get the information you want instead of submitting the form and waiting for it to refresh correctly? It can be easily achieved in remoting.

Instead of using cfformitem to display the result try a cfformgroup with a type of horizontal. And give the cfformgroup an id that you will call with your results.

You would still use the onChange behavior to call the remoting script in you cfselect. Here is a tutorial on remoting.

http://tutorial469.easycfm.com/



Craig
Clearcg.com

raym444
06-11-2007 @ 5:45 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 14
Joined: Apr 2006

that seems like it would work well for supplying the information to display, but it doesn't seem like it would solve the <cfif isDefined('form.lClients')> problem that would allow the text and the button to be shown. For some reason, the drop down list isn't receiving any value even though it changes whats displayed on the control. (which is strange since the control's display is bound to the same <cfif> statement) It just seems like "form.lClients" isn't being defined even when a selection is made.

kicker
06-11-2007 @ 10:19 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 717
Joined: Oct 2004

Remove the cfif display the contents by writing it into the actionscript. Something like this
Write this into your form.
<cfform .... onload="{Payments.visible = false;}">

<cfformgroup type="horizontal" id="showClientInfo">

Write into your cfc the contents of your query into a string

<cfset clientInfo = "#qClient.ClientID# (#qClient.ClientName#)">
Then return that to the results.

When you receive the results write this into the actionscript:

_root.showClientInfo.label=results;
_root.Payments.visible= true;



This will hide and show the stuff you want to hide and show dynamically.

The visible part might be _visible instead of just visible. I didn't have time to check which one is correct for a button.

Sorry so we are clear remove all the stuff including the cfif that comes between the cfif open and close tags.



Craig
Clearcg.com

This message was edited by kicker on 6-11-07 @ 10:24 PM

raym444
06-11-2007 @ 11:21 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 14
Joined: Apr 2006

Thanks Craig, that worked great. I really appreciate the help.


Website Designed and Developed by Pablo Varando.