Skip to main content
Inspiring
May 22, 2006
Question

<cfswitch><cfcase></cfcase></cfswitch>

  • May 22, 2006
  • 5 replies
  • 751 views
I have this <select> with two options and my <select name="vider"> which is some elements that i pull from my SQL server but the problem i am running into is that i have these <input type = "text" name ="loca"> boxes next too these options from my select and i need the value to change in the <input type ="text name="loca"> but does not work though, it tells me that ydate is undefined but i thought i defined it at the begining of my code, and when i added alot of nested <cfif></cfif> it worked but it read the same value for the the <input type="text" name="loca> all the way down........ i cant get it to change based on the seleceditem in the <select><option></option></select>???
This topic has been closed for replies.

5 replies

May 22, 2006
What is ydate, and where does it come from? Do you want it to come from a form? From a database? From a hard-coded CFSET? From CFPARAM? Show the code where ydate gets defined.
Inspiring
May 22, 2006
Ok so what sets "ydate" then??????? i thought <cfset> was all i needed??? Is that not correct.....do i need to make a <cfparam>????or what.....any help!!!
Inspiring
May 22, 2006
I suggest translating your code to simple english, reading it, and seeing if that is really what you want to do. If it's not, change the plain english and base your code on the new version.

For example
<cfif isDefined("ydate")>
<cfset ydate = something>

translates to, "if ydate is there, create it". Is that what you had in mind?
Inspiring
May 22, 2006
This is my code where i believe i have created my ydate varible correctly....and i change my <select> to just a <input type = "text" name="vider"> so i am making descisions based on what value the textbox holds....the ydate is passed to a SQL statment that pulls clients that have appointments two days ahead of the current day......But the textbox holds the same info for all fo them and thats the part that just has me stuck...since i am from the .Net world of SelectedItem properties....but thanks for all the help!!!! If ydate is not defined right please tell me what i should do! please!
May 22, 2006
<CFIF IsDefined("ydate") does not set it. You may be thinking of CFPARAM NAME="ydate" DEFAULT="">
Inspiring
May 22, 2006
Text <cfif IsDefined("ydate") And IsDefined("vider") And FORM.vider IS "Somone"> that is not setting ydate????? I thought you set it at the begining of the <cfif> is that not correct?????

Then i tried it here too....which one is best at the begining or right before you will be using the value......

<cfif IsDefined("ydate")>
<cfquery datasource="bashful" name="res">
Select * From Patients where doc_code ='RA' and date_seen LIKE '%#ydate#' Order By last_name ASC
</cfquery>
</cfif>
Inspiring
May 22, 2006
There are two reasons why your code might not actually run. First, you have code for one value of form.vider but if it's coming from a select, there is more than one available value. Second, that code will only run if ydate is defined.

You say you think you defined ydate at the beginning of your code. I know you didn't set it in the code you showed us.