[thelist] CF Question

Jeff jeff at members.evolt.org
Wed May 10 01:07:12 2000


amy,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Thompson, Amy <AThompson@randomhouse.com>
:
: <CFQUERY .....>
:   update reader_table
:   set read_status=1
:   where reader_id='#form.reader_id#'
: </CFQUERY>
:
: This returns an oracle error code of 1722 - invalid
: number.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

it's an invalid number because you've wrapped the value in single-quotes.
try this instead:

<CFQUERY .....>
  UPDATE reader_table
  SET read_status=1
  WHERE reader_id = #form.reader_id#
</CFQUERY>

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: In an attempt to debug this, I included some javascript
: message boxes to show the value of reader_id at
: different points in the code like this:
:
: <cfif IsDefined("form.reader_id")>
:   <cfset tmp=#form.reader_id#>
:
:   <script language="javascript">
:   alert (tmp);
:   </script>
:
: </cfif>
:
: when I try this i get a javascript error " 'tmp' is undefined"
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tmp is undefined because you're trying to call a javascript variable named
tmp which doesn't exist.  if you want to see the value of the cf variable
tmp, then you'll have to wrap the variable in hash marks (#) and the
<script> block with <cfoutput>.  you may also want to use single or double
quotes in your alert() so it treats it as a string.  one final note, you
don't need to wrap cf variables in hashes if they're within cf tags.  this
is what it should look like:

<cfif IsDefined('form.reader_id')>
  <cfset tmp = form.reader_id>

  <script language="JavaScript" type="text/javascript">
    <!--
      alert('#tmp#');
    // -->
  </script>

</cfif>


good luck,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff@members.evolt.org