we all cringe at our first app(s) .. or atleast I hope WE do : )

glad to help and good luck!
  ----- Original Message -----
  From: Chris Kavanagh
  To: CF-Talk
  Sent: Wednesday, August 18, 2004 9:05 PM
  Subject: SOLVED: setting a default value in my SELECT tag

  Dear Ewok,

  Thank you, you're a genius.  I was just fumbling around the edges of
  that solution, but my way involved all kinds of CFSETs and stuff: using
  the scope is much more elegant.

  My first app is working quite nicely but I bet the code is flabby.  I
  will probably look back on it and cringe one day.

  Thanks again.
  CK.

  On 19 Aug 2004, at 1:55 am, Ewok wrote:

  > try this on for size
  >
  >  <SELECT name="project">
  >  <CFOUTPUT query="get_projects">
  >  <OPTION value="#ID#"<cfif ID is get_details.ID>
  > selected</cfif>>#projectname#</OPTION>
  >  </CFOUTPUT>
  >  </SELECT>
  >    ----- Original Message -----
  >    From: Chris Kavanagh
  >    To: CF-Talk
  >    Sent: Wednesday, August 18, 2004 8:33 PM
  >    Subject: setting a default value in my SELECT tag
  >
  >    Dear list,
  >
  >    I'm sure there is a simple answer to this basic question.  Sorry for
  >    being such a noob: I'm working on my first application!  I hope to
  >    become a useful member of the CF community one day.  But first you
  > will
  >    have to put up with my stupid questions for a while.
  >
  >    Stupid question the second: I have a <select> element in a
  > form.  The
  >    options are populated from a database.  It looks a bit like this:
  >
  >    <CFQUERY name="get_projects" datasource="datasource">
  >    SELECT projectname FROM projects
  >    </CFQUERY>
  >
  >    ...
  >
  >    <SELECT name="project">
  >    <CFOUTPUT query="get_projects">
  >    <OPTION>#projectname#</OPTION>
  >    </CFOUTPUT>
  >    </SELECT>
  >
  >    It works beautifully so far, giving me a list of all the projects
  > in my
  >    database.  But I'd like it to default to a certain value from
  > another
  >    query.  So I added some more code:
  >
  >    <CFQUERY name="get_details" datasource="datasource">
  >    SELECT projectname FROM projects
  >    WHERE ID=[a certain value]
  >    </CFQUERY>
  >
  >    <CFOUTPUT query="get_details">
  >    <SELECT name="project" value="#projectname#">
  >    </CFOUTPUT>
  >    <CFOUTPUT query="get_projects">
  >    <OPTION>#projectname#</OPTION>
  >    </CFOUTPUT>
  >    </SELECT>
  >
  >    But it just doesn't work: it won't default to the value from the new
  >    query.  Am I being a total moron?
  >
  >    TIA,
  >    CK.
  >
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to