• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Participant ,
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

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>???
TOPICS
Advanced techniques

Views

604

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

<CFIF IsDefined("ydate") does not set it. You may be thinking of CFPARAM NAME="ydate" DEFAULT="">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

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!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

LATEST
U need to change your code structure making sure the Query is at the top of when u try and use your result set and forget that complicated <cfswitch> just hard code the value that should be change in tdate so if its <cfif tdate IS 1> <cfset tdate TO 3> get it????? but that fixed my problems....One thing good about coldfusion it seems it likes real simple code...but anyway here is the code thats works...thanks self!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation