Setting a form select value while using CF bind

I can get the first select to work using the cfif statement...

<option value="#lastState#" <cfif #laststate# eq '#cookie.state#'>selected</cfif>>#titleCase(lastState)#</option><br />

However, I don't know what to use as a variable to check the variable...

 <cfselect name="city" bindOnLoad="Yes" bind="cfc:city.getCity({state})" class="inputForm" <cfif city.getCity eq ''>selected</cfif> />
Who is Participating?
_agx_Connect With a Mentor Commented:
That should work for CF9. AFAIK it's not built into CF8.  For CF8, you need to use a work around like this:
monosythAuthor Commented:
hmm, couldn't get that example to work with my code... any help using my existing code?
monosythAuthor Commented:
Perfect, had some extra help to figure this out. Thanks!
Related selects are a little more complicated, because you have to wait for the bind to the other field {state}.. to complete first.  Did you see fix mentioned in the comments section (#13)? I think that should work in either scenario.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.