Skip to main content
Inspiring
September 8, 2006
Question

dynamic drop down based on user selection

  • September 8, 2006
  • 2 replies
  • 387 views
hi all, ok, I have a table which contains use data, a name, and a userID. for the example lets say "Simon Bullen" and my userID is "999".
on a form I have, there is a dropdown box, which is dynamic from this table, and allows me to select Simon Bullen, however, I have a hidden field on the form, which when the user selects "simon bullen" the hidden field populates with the appropiate U number from the same table.... no i thought this would do it:

<cfquery name="userNumber" datasource="userList">
SELECT userNumber FROM dbo.Users WHERE Name =
<cfqueryparam value="#form.Name#">
</cfquery>

and then my dynamic form field (hidden) would reference to this query....

but it doens't work, could somebody please enlighten me? I'm hoping its something silly

Thanks in advance
This topic has been closed for replies.

2 replies

Inspiring
September 11, 2006
Is there a particular reason why you want to set the dropdown value to
another field rather than referencing it directly.

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"Simonbullen" <webforumsuser@macromedia.com> wrote in message
news:edrrik$feu$1@forums.macromedia.com...
> hi all, ok, I have a table which contains use data, a name, and a userID.
> for
> the example lets say "Simon Bullen" and my userID is "999".
> on a form I have, there is a dropdown box, which is dynamic from this
> table,
> and allows me to select Simon Bullen, however, I have a hidden field on
> the
> form, which when the user selects "simon bullen" the hidden field
> populates
> with the appropiate U number from the same table.... no i thought this
> would
> do it:
>
> <cfquery name="userNumber" datasource="userList">
> SELECT userNumber FROM dbo.Users WHERE Name =
> <cfqueryparam value="#form.Name#">
> </cfquery>
>
> and then my dynamic form field (hidden) would reference to this query....
>
> but it doens't work, could somebody please enlighten me? I'm hoping its
> something silly
>
> Thanks in advance
>


Inspiring
September 11, 2006
Thanks for the reply, see what i'm trying to do is have the user insert thier 'common name' and thier 'user number' as I need both in the database. But i didn't want them to have to select both, so I thought there might be a relativly easy way to automatically select thier user number when they select thier name....

do I make sense?
Inspiring
September 8, 2006
Sorry forgot to say, am using DM8, SQL and CF7

thanks