CFINPUT selected has "/" in it and will not work.

I have a CFQUERY to a SQL Server database that  populates a drop down for a CFSELECT function on my web page form. I am trying to set the "SELECTED" to a value that contains an "/" (ie. Valid/Active). When setting the selected to an item that contains an "/" it will not display as selected. No problem with values not containing "/". The values containing the "/" will show up on the drop down, and can be selected from that drop down, I just can not get one of them to be the default selected.

There is probably a simple solution but I can not think of it right now.
apwbeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pmascariCommented:
The browser is probably seeing the / and interpreting it to be the end of the tag.  If you must have the / in the HTML value, try moving the code to determine if it's selected outside of the tag itself like this:

<cfif value is "Valid/Active">
  <cfset OptionSelected = "SELECTED">
<cfelse>
   <cfset OptionSelected = "">
</cfif>

<cfoutput>
<cfselect name="mySelectTag" size="1">
<cfloop>
  <option value="Valid/Active" #OptionSelected#>Valid/Active
</cfloop>
</cfselected>
</cfoutput>
0
mrichmonCommented:
There must be some other bug with your code.  Can you show your code.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
apwbeAuthor Commented:
pmascari

I have not been able to try your code yet. Will try and get to it sometime today.

mrichman

Hello my friend. Thanks for your past help on matters. Here is the CFSELECT code. Seems pretty direct. It just does not like the "/" in the data.

<CFQUERY NAME="Select_Status" DATASOURCE="liquor_lic_data">
SELECT      Status
FROM         dbo.Status_Domain
</CFQUERY>
.........

<cfoutput>
      <cfselect name="Status"
                      query="Select_Status"
                      value="Status"
                      selected="Valid/Active"
                      tabindex="8">
      </cfselect>
</cfoutput>
0
mrichmonCommented:
Ah, okay it is the cfselct that doesn't like it.

I see 2 options.

1)
<cfoutput>
    <cfset Selected = "Valid/Active">
     <cfselect name="Status"
                    query="Select_Status"
                    value="Status"
                    selected="#Selected#"
                    tabindex="8">
     </cfselect>
</cfoutput>

But I dont' know if that will work.

2)
Use a regular html select isntead of cfselect.  cfselect does have some bugs as you can see from this problem.  Regular would look like:
<cfoutput>
     <select name="Status" tabindex="8">
           <cfloop query="Select_Status"><option value="#Status#" <cfif Status EQ "Valid/Active"> selected</cfif>>#Status#</option></cfloop>
     </select>
</cfoutput>
0
apwbeAuthor Commented:
mrichman,

I had to use the <select> instead of the <cfselect> and I also had to enter it by hand and not use the tag wizard in Homesite. For some reason the code created by the wizard (even though it looked exactly like the code I entered) would not work. I was able to figure it out using your <select> suggestion.

Thanks,

Warren
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

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.