Title: Array help...
Marlon,
 
Here is the latest version of the code:
 
<CFLOOP Index="i" From="1" To="#ArrayLen(SESSION.Cart)#">
<CFIF SESSION.Cart[1] IS #model#>
<CFSET Position = i>
<CFBREAK>
</cfif>
</cfloop>
 
<cfparam name="position" default="ArrayLen(session.cart) + 1" >
 
<CFIF Position LT ArrayLen(session.cart)>
<cfset session.cart[position][4]=session.cart[position][4] + form.quantity> 
<CFELSE>
<cfquery name="get_products" datasource="#dsn#" dbtype="ODBC">
     select * from products
     where model='#model#'
     </cfquery>
<cfset session.cart[position][1]="#get_products.model#">
<cfset session.cart[position][2]="#get_products.header#">
<cfset session.cart[position][3]="#get_products.price#">
<cfset session.cart[position][4]="#form.quantity#">
</cfif>
 
I keep getting this error:
 

An error occurred while evaluating the expression:

 session.cart[position][1]="#get_products.model#"

Error near line 46, column 29.

The expression specifying dimension 1 of the object session.cart is not an integer expression. Only integer expressions can be used to index objects.

- Gary

 
 
-----Original Message-----
From: Marlon Moyer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 3:09 PM
To: [EMAIL PROTECTED]
Subject: Re: Array help...

Should this be
 
SESSION.Cart[1] IS "#model#"
----- Original Message -----
From: Houk, Gary
Sent: Wednesday, May 23, 2001 2:02 PM
Subject: RE: Array help...

After adding in that line, when I initially go to the page I get:
 

Error Diagnostic Information

An error occurred while evaluating the expression:

 session.cart[position][4]="#evaluate(session.cart[position][4]+1)#"

Error near line 38, column 29.
 
 
but after hitting the refresh button:
 
 

Error Diagnostic Information

An error occurred while evaluating the expression:

 SESSION.Cart[1] IS #model#

Error near line 30, column 22.
 
 
Any ideas?
-----Original Message-----
From: Marlon Moyer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 3:00 PM
To: [EMAIL PROTECTED]
Subject: Re: Array help...

I forgot to add this too:
 
<cfparam name="position" default="#evaluate(ArrayLen(session.cart) + 1)#" >
 
Marlon
 
----- Original Message -----
From: Houk, Gary
Sent: Wednesday, May 23, 2001 1:36 PM
Subject: Array help...

All,

I'm trying to get into working with arrays by setting up an ecommerce app, and am having some trouble with it. The file I'm working with is attached and the error is:

Error Diagnostic Information

An error occurred while evaluating the expression:

 session.cart[position][4]="session.cart[position][4] + 1"

Error near line 38, column 29.


If anyone could assist with this it would be greatly appreciated, since I have now spent hours on it :-)

Thanks,

Gary


-----Original Message-----
From: Karen Harker [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 1:27 PM
To: [EMAIL PROTECTED]
Subject: Re: Required textarea box


Thank you very much for your assistance. This looks like it will work. 

However, how can I integrate it with the data validation provided with CFFORM?  The onSubmit event must reference one function, and CFFORM will automatically plug in its own function, overwriting the textarea check function. 

Thanks, again.
Karen
>>> [EMAIL PROTECTED] 5/23/01 9:25:44 AM >>>
Hope this js validation would help you.

Prabu

------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">

<html>
<head>
        <title>Text area check</title>
<script language="JavaScript">

function checkmyForm(){

        var newString = new
String([document.myForm.myText.value]); 
       
        if (newString.length == 0 ){ 
       
                alert("Text area is empty");  
               
                return false;
               
         } 
        
}
</script>

</head>

<body>


 <cfform name="myForm" action="yourTarget.cfm"
method="POST" enablecab="Yes"  onsubmit="return
checkmyForm()">
 
 <cfinput type="Text" name="input1" message="Input 1
is empty" required="Yes"><br>
 
 <cfinput type="Text" name="input2" message="Input 2
is empty" required="Yes"><br>
 
 <textarea cols="32" rows="4"
name="myText"></textarea><br> <br>
 
 <input type="submit"  value="submit">&nbsp;&nbsp;
 
 <input type="reset"   value="reset">
 
 </cfform>

</body>
</html>


------------------------------
--- Karen Harker <[EMAIL PROTECTED]>
wrote:
> I am using a CFFORM, but I'd like to have a textarea
> box (or some multi-line input box) required.
> Besides writing my own Javascript for all data
> validation, what can I do?
>
> BTW, what if I want to use the CFFORM data
> validations, along with my own client-sided data
> validation for the same form; what could I do? I've
> tried including the javascript, but it only runs the
> data validation for CFFORM.
>
> Thanks.
>
>
> Karen R. Harker, MLS
> UT Southwestern Medical Library
> 5323 Harry Hines Blvd.
> Dallas, TX  75390-9049
> 214-648-1698
> http://www.swmed.edu/library/
>


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org


-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

 

Reply via email to