CF variable in Javascript is "undefined"

Hi everyone,
can you please tell me why the output is "undefined"?
this is the code:
<cfset checkcolor="No">
<script language="JavaScript">
function check()
x=document.checkcolor;
alert(x);
return false;
<cfquery datasource="#DSN#" NAME="items">
select *
from items
where itemID=#ItemID#
</cfquery>
<cfform action="Order.cfm" method="POST" name="F1"
onsubmit="return check();">
<cfif Items.ItemColors neq "">
<cfset checkcolor="Yes">
the alert shows "undefined"
I would appreciate any help!

it doesn't do anything! it assumes that the checkcolor is
always "no". this is the complete code. can you tell me what is
wrong with it? thanks a lot in advance.
<cfset checkcolor="No">
<cfset checksize="No">
<script language="JavaScript">
function checkit()
<cfif checkcolor is "Yes">
if
(document.F1.MyColor.options[document.F1.MyColor.selectedIndex].text
== 'Select a Color:')
alert("Please Select a Color!");
return false;
</cfif>
</script>
<cfquery datasource="#DSN#" NAME="items">
select *
from items
where itemID=#ItemID#
</cfquery>
<cfform action="Order.cfm" method="POST" name="F1"
onsubmit="return checkit();">
<cfoutput>
<br>
<table cellpadding="0" align="left" cellspacing="5"
border=0 class="textblack">
<tr>
<td width=40% valign="top" align="center">
<img src="PixBig/#Items.ItemImage#" border="2"
alt="#items.ItemName#" ><br>
<br>
<div align="center">
<font class="textGray"><b>Price:</font>
<font
class="textGreenBold">#Dollarformat(Items.UnitPrice)#</font></b>
</div>
</td>
<td width=2%> </td>
<td width=53% valign="top"
class="textblack"><br>
<b>#items.ItemName#</b>
<br>
<p style='line-height:14.0pt'>
<font class="textblack">
#items.ItemDetail#</font>
<br>
#items.Description#
</p>
<cfif Items.ItemColors neq "">
<cfset checkcolor="Yes">
<cfset TempColorList=Items.ItemColors>
<cfquery datasource="#DSN#" name="ColorInfo">
select *
from Colors
where ColorID in (#TempColorList#)
</cfquery>
Color:
<cfselect name="MyColor" query="ColorInfo" value="Color"
REQUIRED="yes" message="Please select a Color!">
<option value="" selected>Select a Color:
</cfselect>
</cfif>
<br><br>
<cfif Items.ItemSizes neq "">
<cfset CheckSize="Yes">
<cfset TempSizeList=Items.ItemSizes>
<cfquery datasource="#DSN#" name="SizeInfo">
select *
from Sizes
where SizeID in (#TempSizeList#)
</cfquery>
Size:
<cfselect name="MySize" query="SizeInfo" value="Size"
REQUIRED="yes" message="Please select a Size!">
<option value="" selected>Select a Size:
</cfselect>
</cfif>
<br><br>
<input type="hidden" name="Quantity" value="1">
<input type="submit" name="Buy Now!" value="Buy Now!"
><br>
</td>
</tr>
<tr>
<td align=left >
<font class="textgray">Item Number:</font>
<font class="textblack">#Items.itemnum#</font>
</td>
<td> </td>
<td valign="bottom"><br><br>
<br><br>
</td>
</tr>
</table>
<input type="hidden" name="ItemID" value="#ItemID#">
</cfoutput>
</cfform>

Similar Messages

  • Accessing c4 Variables in Javascript

    How do you pass a Captivate 4 variable (User or System) in Javascript when the published .SWF is embedded in another tool like Lectora or Flash?
    In Captivate, you can set a value into a Lectora variable (VARmyLectoraVariable.set('myvalue');, but I don't know how to access the Captivate variable.
    When run from Captivate, this works:
    Captivate.GetVariable('CaptivateVariable');
    But when the published .swf from Captivate is inserted into Lectora and run, I get a JavaScript error ('Captivate' is undefined).
    How do you reference the Captivate variable in JavaScript when the .swf is not embedded in the Captivate project html file?
    Thank you!

    http://pipwerks.com/journal/2009/06/07/introducing-the-captivatecontroller/
    check this out

  • Public variables in javascript

    how i can use public variables in javascript along with ADF. I am declaring a variable at the top of list but when an event is generated by ADF and i tries to access that variable, it gives me an error of undefined.
    Kindly help me

    Not directly, but you can with this:
    http://java.sun.com/products/plugin/1.3/docs/jsobject.html
    See also:
    http://www.codeproject.com/jscript/javatojs.asp?df=100&forumid=736&exp=0&select=700857

  • Using Flash variable in Javascript problem

    I want Flash to load a rss feed and hand it to Javascript
    which will do the parsing and rendering. AFAIK Javaswcript can't
    load external documents and include them into the current html page
    for some security reasons. So I try this approach.
    I attached the code I have. My Problem is that Flash does
    pass the variable to javascript but the document.write overwrites
    everything else in the current html document.
    I don't want to work with popups for obvious reasons. The
    variable must be included in the _current_ document.
    Can anyone give me a hint how to get this working properly?

    What is happening is the XML file is getting cached by the browser.
    There are a few different ways to fix this, but this is what I have found to be the easiest.
    In the Actionscript, where the call to load the xml is, append a random string to the end of the call.
    so:
    (This is AS2 code - so a conversion is necessary if using AS3)
    myXML.load("http://path/to/xml.xml?r="+Math.round(Math.random()*99999999999999999999999999999999999999999999999));
    What this will do is tell the browser that you are calling a unique file every time you try to load the xml, which will forcefully bypass the cached version.

  • How to pass a jsp variable into javascript??

    <p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <p><html>
    <p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
    <p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
    <p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
    <p>Time until next game
    <p><c:forEach var="tuple" items="${tuples}">
    <p><c:if test="${fn:contains(tuple, 'row ')}">
    <p> <p><code>
    <p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
    <p> <font color="blue">
    <p> <c:out value="${values[17]}" />
    <p><c:set var="remainingtime" value="${values[17]}" />
    <p> </font>
    <p> </code>
    <p></c:if>
    <p></c:forEach>
    <p><form name="counter"><input type="text" size="8" name="d2"></form>
    <p><script>
    <p>var milisec=0
    <p>var seconds=eval("document.myForm.remaining").value;
    <p>function display(){
    <p> if (milisec<=0){
    <p> milisec=9
    <p> seconds-=1
    <p>}
    <p>if (seconds<=-1){
    <p> milisec=0
    <p> seconds+=1
    <p> }
    <br>else
    <p> milisec-=1
    <p> document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
    <p>}
    <p>display()
    <p></script>
    <p></body>
    <p></html>
    <p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001

    Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
    <html>
    <body>
    <form name=f>
    <%!
    String str = "A String"
    %>
    <script>
    var avariable = <%=str%>
    <script>
    </form>
    </body>
    </html>
    Let me know if you face any problem

  • Variable calc.FiscalYearSumconservativeBudget is undefined.

    Hi,
    I have created a report with two groups: Manager and FiscalYear. The Report Builder generated all calculated variables.
    I can display totals on the Manager level. However when I try to display a sum of ConservativeBudget in the FiscalYear footer, I have this error:
    Variable  calc.FiscalYearSumconservativeBudget is undefined.
    The  error occurred in D:\sites\invivoteipo.com\reports\forecastingDetails.cfm:  line 18
    16 :
    17 : <cfreport format="pdf" template="ForecastingDetails.cfr" query="#CFReportDataQuery#">
    18 :      <cfreportparam name="FiscalYear" value="#FiscalYear#">
    19 : </cfreport>     
    I have tried to create this calculated variable myself, with the same results. If I drag this field to the FiscalYear header, I have no errors and I can see 0 as the value.
    Any idea what is going on?
    Thank you in advance.
    JK

    <CFQUERY name="cr" datasource="sire" dbtype="odbc">
      SELECT page_id
      FROM  sire.dbo.CORNER_REPORTS_Page
      WHERE page_id = <cfqueryPARAM value = "#page_id#"     <!--- Here you're referencing #page_id#, which hasn't been set anywhere
                                          CFSQLType = 'CF_SQL_INTEGER'>
    </cfquery>
    In the query, you're referencing a variable called page_id, but you haven't set that anywhere. Did you mean to use #url.corner#? You have a URL variable in there which looks suspiciously like it's there for a reason
    There's then no reason to set the result to anything afterwards, you can just reference the variable using queryname.columnname (assuming it only returns one row) - ie:
    <cfoutput>#cr.page_id</cfoutput>
    Hope that halps a little.

  • Setting variables in Javascript

    Hello all,
    We are trying to set a variable in javascript like so:
    var myFish = $v('P22_EPSB_SGF_GROUP').value;
    does not work. Yet the statement
    if ($v('P22_EPSB_SGF_GROUP') == '2')
    can be evaluated.
    Any help would be appreciated.
    Thanks

    lilhelp,
    The $v function returns the value so you don't need the ".value"
    The $x function returns the element so you would need the ".value"
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen

  • How can we  use java variable in javascript code on JSP page?

    How can we use java variable in javascript code on JSP page?
    Pls help

    Think about it:
    JSP/Java is executed on the Server and produces HTML+JavaScript.
    Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
    Obviously there's no way to access a Java variable directly from JavaScript.
    What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable.

  • Set global x01 variable in javascript?

    Is it possible to set the x variables in javascript ? eg.
    $s('x01', 'some text');
    alert("my value = " + $v('x01');
    does not seem to be working for me
    Thanks
    Jon

    Hello Jon,
    It seems like I owe you an apology. I didn’t pay too much attention to the logic you are trying to implement, plus I thought you’ll also consider Rutger post. To be honest, I never tried to use x01-x10 outside an on-demand process, until your thread.
    So let’s start from the beginning. Although we are using the term global variables with regards to the x01-x10 variables (and they are indeed defined as global variables in the wwv_flow package) they don’t have the same functionality as application items, and in our context, mainly persistence. In fact, they were created to save us the need to define application items as temporary items, to be used only to pass values in AJAX processes.
    If you set one of these variables, using the addParam() method, its value will be available to you in the on-demand process that you reference in your AJAX request, but the value will not be set in session-state (like application/page items) and will not be persistence.
    If you want to use this value outside the on-demand process, you need to assign it to a page or application item. In your case the code
    :P1_MY_PAGE_VALUE := apex_application.g_x01;should be part of the on-demand ‘jmf_test' process. The P1_MY_PAGE_VALUE should be set with a Source Used of “Only …” so it will be populated from session state.
    The code of
    var ajaxRequest = new htmldb_Get(null, $v('pFlowId'),null, 0);should only be used when you need to save session state of application/page items from JavaScript (and not with the x01-x10 variables).
    Hope this time things are clearer and you’ll be able to achieve what you need. If, for any reason, they are not, please post again.
    Regards,
    Arie.
    Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

  • Passing variable from javascript to servlet!!!

    Hi all,
    I have one doubt,
    can we pass a variable from javascript to servlet???
    In Brief,
    i am getting some values in javascript through jsp and the same values i
    want to use in servlet.
    Yes, i know i can get these values in servlet by using request.getParameter("");
    But these values are dynamically generated so i dont know how many varaible are they!. so i am trying to put some array list so that i can forward this values to servlet.
    But i can't get this array which is declared in javascript!! :( so any buddy can help me how to get this dynamically generated values in servlet!!!
    Thanks in Advance!! :)

    can you post a sample of your code?
    remember to put it between tags                                                                                                                                                                                       

  • How can i access and assign java xml Document variable in javascript block

    How can i access and assign org.w3c.dom.Document variable in javascript block
    I tried this xmlDoc = "<%=xmldoc%>";
    it is not working
    plz give me solution.
    thanx
    Vidya

    The solution would only work on MS IE browsers, as other browsers do not support an XML DOM.
    It can be done, but you would be stuck with using the Microsoft broswer. If that is acceptable, I have some example code, and a book recommendation.

  • JSP variable in javascript

    Can I use a jsp variable in javascript? If so, how? It would be used in an "if" statement:
    function get This() {
    if (document.form.tfName.checked==true) || (<%jsp>) {
      then do this...}
    }

    My problem is I am grabbing a persistant value from a
    value object: the value of a checkbox as
    <%=InformationVO.isChecked()%>If (==true) i want javascript to enable a button on
    load. If not disable it. Plus I hav javascript on
    the page that controls this while the page is open.
    Just don't know how to incorporate the two scenarios
    s for:
    1.checking the value to ernable/disable the sumbit on
    load with the value of the VO
    2. using javascript to control the enable/disable
    while page is laodedYou want something like this?
    <%
    boolean enableButton = InformationVO.isChecked();
    %>
    <html>
    <head>
    <script language="javascript">
    // load event, enables or displables button depending on the InformationVO.isChecked value.
    function doMyLoadEvent(){
         if(<%=enableButton%>){
              // enable mySubmitButton object
         }else{
              // disable mySubmitButton object
    // submits the form
    function submitForm(){
         var frm = document.forms[0];
           frm.action = "path to your servlet goes here";
           frm.submit();     
    </script>
    </head>
    <body onload="javascript:doMyLoadEvent()">
    Woopdy doo!
    <form method="post" action="" name="">
    <input type="button" name="mySubmitButton" value="Submit" onclick="javascript:submitForm()">
    </form>
    </body>
    </html>

  • [CS3] How to add via plugin some variable into javascript object model?

    Otherwords i need access to some plugin variable from javascript.

    The BPI plugin source is pretty well documented via comments. If you don't like page items, search the .fr for any reference to "page item" and "PageItem", then remove those references.
    Depending on your specific purposes, also eliminate the persistent BPIDataPersist and related, or anything with "Panel" in it. This should give you a very minimum plugin.
    If you don't want a structure that behaves like a "prefs", remove kBPIPrefsScriptProviderBoss and all related.
    To add a property on a another boss rather than on page items, just replace kPageItemObjectScriptElement in the kBPIScriptProviderBoss of the VersionedScriptElementInfo, e.g. with kApplicationObjectScriptElement.
    app.documents is probably not what you want to follow, because that is a collection rather than an array so you would be implementing an own object type.
    Of course, keep a copy of your intermediate steps and whenever too much breaks, retry. That's how we all started ...
    Dirk

  • Setting OBI variables in JavaScript

    Is there some way to set OBI variables from JavaScript? And I mean any way, a Go URL syntax, pretending to be a Prompt, AJAX...candles and incense...anything!! : )
    I have some embedded HTML, and when the user clicks on a button/link/whatever, I need to set one or more an OBI variables for later use by a direct query Answers report.
    Thanks very much.

    lilhelp,
    The $v function returns the value so you don't need the ".value"
    The $x function returns the element so you would need the ".value"
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen

  • Pass a url variable to javascript for drop down menu

    Hello,
    I'm in over my head as far as javascript goes. This is what I
    am trying to do. I have this URL...
    http://www.grasshorse.com/prod2.cfm?SortBy=all&ProdAbbr=shm
    I want to take the variable for ProdAbbr which in this case
    is "shm" and make that a variable in javascript. So that I can add
    the variable to a dynamic link I'm using for a drop down menu.
    mm_menu_0520211545_0.addMenuItem("All Departments","location='prod.cfm?SortBy=all&ProdAbb r=eval(ProdAbbr)'");
    I really have no clue what to do. I haven't hardly used
    javascript at all and I'm looking for some charity. Does anyone
    have any ideas on how I can do this?
    Thanks
    Steve
    Any insight is greatly appreciated.

    jawwinker wrote:
    > Hello,
    > I'm in over my head as far as javascript goes. This is
    what I am trying to
    > do. I have this URL...
    >
    > <a target=_blank class=ftalternatingbarlinklarge
    > href="
    http://www.grasshorse.com/prod2.cfm?SortBy=all&ProdAbbr=shm
    >
    > I">
    http://www.grasshorse.com/prod2.cfm?SortBy=all&ProdAbbr=shm
    >
    > I</a> want to take the variable for ProdAbbr which
    in this case is "shm" and
    > make that a variable in javascript. So that I can add
    the variable to a
    > dynamic link I'm using for a drop down menu.
    >
    >
    mm_menu_0520211545_0.addMenuItem("All Departments","location='prod.cfm?Sort
    > By=all&ProdAbbr=eval(ProdAbbr)'");
    mm_menu_0520211545_0.addMenuItem("All Departments","location='prod.cfm?Sort
    By=all&ProdAbbr='"+ProdAbbr+"'");
    Mick

Maybe you are looking for

  • PI 7.0 Support Pack 16 Release Note

    hi We are starting up with SAP NetWeaver 2004s Support Pack 16 deployment. Our environment is, Windows 2003, MS SQL Server and PI 7.0. Would appriciate if you help me with release note if any and any helpe/tips around this stack deployment. Thanks Se

  • Chart digital display format keeps changing

    I am running Labview 8.5.1 on windows XP. My digital display for my chart keeps changing to %.2f format when I run the VI. I tried setting the display format to scientific but as soon as I run the VI, it changes back to floating point. I have include

  • Export error ORA-942

    I'm on a redhat linux oracle 9.2.0.1.0 I try to export a shema the ora-00942 appears ora-00942 tables or views does not exist exp-00-24 export views not installed... I run de catexp7.sql and catexp.sql but the message appears again . could you help m

  • CUP - default roles

    Hi, We are on AC5.3, SP11. I have configured default roles in CUP. Configuration is as follows: u2022     Consider default roles: Yes u2022     Request Type: New Account u2022     Default role level: Request u2022     User attributes: System u2022   

  • How to read activity monitor????

    My system keeps freezing up while using garageband. I've noticed on activity monitor that the "green/% user" bars are peeked, while the "red/% system" bars are relativly low. First: How do I interpret these colors? Second: what can be causing problem