Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Binding from cfc query to form fields

New Here ,
Jan 06, 2011 Jan 06, 2011

I wrote a simple cfc that houses a query pof my db. The query takes one argument that is the id of the record it is supposed to pull. What I am attempting to do is build a form to maintain the records of the db. In my form, I have a cfselect that allows the user to select the record from the db. The value of the cfselect is the id. I want the form to be populated with the query data from the cfc based upon the end users selection from the cfselect. I am getting it to pull the data from the cfc as I have dumped that to the page. I have not been successful in getting the form to populate with the data though. Here is my code...

My cfselect:

                        <cfselect name="webinar_classes" id="webinar_classes">
                            <cfoutput query="WebinarClasses">
                                <cfif WebinarClasses.currentrow is 1>
                                    <option value="#WebinarClasses.CLASSESID#" selected>#WebinarClasses.TITLE# #DateFormat(WebinarClasses.DATE, 'mm/dd/yy')#</option>
                                <cfelse>
                                    <option value="#WebinarClasses.CLASSESID#">#WebinarClasses.TITLE# #DateFormat(WebinarClasses.DATE, 'mm/dd/yy')#</option>
                                </cfif>
                            </cfoutput>
                        </cfselect>

My cfinput with the binding code:

<cfinput name="endTime" id="endTime" value="" size="3" bind="cfc:webinar_admin.cfc.webinar_admin.getEditendtime({webinarClassesedit:webinar_classes})" />

Any help would be appreciated.

5.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 23, 2011 Jan 23, 2011
LATEST

Now, validating for the date, and using a row index:

<cfquery name="WebinarClasses" datasource="activantcorpsitedb">
    SELECT WEBINARCLASSES.DATE, WEBINARCLASSES.ENDTIME
    FROM WEBINARCLASSES
    LEFT JOIN WEBINARS
    ON WEBINARS.ID = WEBINARCLASSES.WEBINARID
    WHERE WEBINARS.ID = WEBINARCLASSES.WEBINARID AND WEBINARCLASSES.DATE   >= #Now()# AND WEBINARCLASSES.ID = #arguments.webinarClassid#
    ORDER BY WEBINARCLASSES.DATE
</cfquery>

<cfif isDate(WebinarClasses.ENDTIME[1])>
      <cfset datetimeObject = parseDatetime(WebinarClasses.ENDTIME[1])>
     <cfset editEndtime = TimeFormat(datetimeObject,'short')>
<cfelse>
    <cfset editEndtime = "Invalid time">
</cfif>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources