Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / December 2005



Tip: Looking for answers? Try searching our database.

Drown Down Menu Seleted

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DDDonna - 23 Dec 2005 00:30 GMT
:(
Hello and Happy Holidays!  

All I want for Christmas is to complete my code.

I have a form page that is populated from a database.  It populates correctly
but then i do on update to the database and i get stuck on the drop down menus.
I do this to get my data and have one selected...

<select name="StatusID">
     <option value="#GetFiles.StatusID#" selected>
<cfoutput>#GetFiles.Staus#</cfoutput></option>
           <cfoutput query="GetStatus">
      <option value="#StatusID#">#Staus#</option>
            </cfoutput>
</select>

This works great!!!!  But when i go to the update page(hit submit)  you must
rechoose the drop down and if i try it another way, i get an error.

I am just trying to update the database and not have to change the dropdown
unless the value changes.  I hope i am making sense.

Off to wrap presents...is there ever an ending?  

Thank you,
DDonna
The ScareCrow - 23 Dec 2005 02:32 GMT
You need to check the submitted form value against the value returned from the
db, but you also need to check if the form value is defined (the form has been
submitted)

<option value="#StatusID#" <cfif isdefined("form.StatusID") and form.StatusID
IS GetStatus.StatusID>selected</cfif>>#Staus#</option>

You should also do this to the option outside the cfoutput query

Ken

Ken
Dan Bracuk - 23 Dec 2005 02:40 GMT
Or you can use cfselect which has a selected attribute.
The Dagger - 28 Dec 2005 19:43 GMT
The following cfselect tag has to used insided a cfform tag.

<cfselect name="StatusID"
                 query="GetStatus"
                 value="StatusID"
                 display="Status"
                 selected="#variables.StatusID#">
</cfselect>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.