Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2006-04-04
5
Medium Priority
?
202 Views
Last Modified: 2013-12-24
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.
0
Comment
Question by:apwbe
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:pmascari
ID: 16373139
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
 
LVL 35

Accepted Solution

by:
mrichmon earned 750 total points
ID: 16374989
There must be some other bug with your code.  Can you show your code.
0
 

Author Comment

by:apwbe
ID: 16375559
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
 
LVL 35

Expert Comment

by:mrichmon
ID: 16376529
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
 

Author Comment

by:apwbe
ID: 16512332
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question