Sorry, I guess I am trying not to be too verbose. Let me try again.

The solution you gave for "Displaying the first value from cfoutput" was
great, thanks.
Now I realise that I need the variable to hold the default value from the
database on the first pass, but when the user selects a value from the list
box I want that to become the current value.
 
    <cfquery name="userinfo" datasource="db1">
    SELECT DomainName
    FROM Domains</cfquery>
    <cfset variables.CurrentDomain = userinfo.DomainName[1] />
     
    <cfoutput>#variables.CurrentDomain#</cfoutput>
    
    <FORM action="admin.cfm" method="post">
    <SELECT name="listboxdomain">
    <cfoutput query="userinfo">
    <OPTION value="#DomainName#">#DomainName#
    </CFOUTPUT>
    </SELECT>
    <input name="Go" type="submit">
    </FORM>

The template is named "admin.cfm", so I am having the form call itself.
 
How can I detect if it the first time the template has been called, so that
I can assign the var the results of the db code on the first pass, and the
value of the listbox on the other passes?
 
Rodger

From: Charlie Griefer [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 03, 2005 11:46 AM
To: CF-Talk
Subject: Re: Displaying the first value from cfoutput

sorry, didn't read the part about setting it into a var...

<cfset myFirstRecord = myQuery.columnName[1] /> should do it :)


On Thu, 3 Feb 2005 14:45:08 -0500, Charlie Griefer
<[EMAIL PROTECTED]> wrote:
> <cfoutput>#queryname.fieldname#</cfoutput> will do it.
> 
> 
> On Thu, 3 Feb 2005 11:34:12 -0800, Rodger <[EMAIL PROTECTED]> wrote:
> > I use a cfquery to retrieve a small list.
> > I then want to display the first value returned as the default, and 
> > populate all of the items into a list box.
> > The list box populates ok, but when I use cfoutout query=, I get all 
> > values displayed.
> >
> > How can I capture the first value into a variable, so that I can 
> > then use it as the default?

 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193021
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to