Date:  04/29/2002 06:08:39 AM Msg ID:  000596
From:  Sunil Shah Thread:  000587
Subject:  Re: Re: Foxpro arrays and javascript arrays
Thanks for that.
 
I am hoping to create an HTML form for multiple lines of data that need to be manipulated together.
 
This would be my plan :
1. Transfer data from foxpro table to javascript array like you have suggested.
2. The value of the form elemts would be values from the array.
3.  As value of form element changes, array values change.
4.  Finally use FormArray method gather all form values and pass them back to the dbf via sql update.
 
That is what I'd like to do.  I will be embarking on ths project soon to see if it feasible what I'd like to do.
 
Sunil
 
 
 
Sent by FoxWeb Support on 04/24/2002 09:42:37 PM:
Can you please be more specific?  VFP arrays are used by fwx scripts on the server, while JavaScript code runs on the browser.  Are you trying to generate JavaScript code on the fly and you want to populate an array with the contents of a VFP array?  If yes, you can do something like the following in your fwx script:
 
<script language="javascript">
var myJSArray = new Array();
var curRow = 0;
<%FOR i = 1 TO ALEN(myVFPArray)%>
myJSArray(curRow++) = '<%=myVFPArray(i)%>';
<%NEXT%>
</script>
 
The resulting code will be:
 
<script language="javascript">
var myJSArray = new Array();
var curRow = 0;
myJSArray(curRow++) = 'apple';
myJSArray(curRow++) = 'orange';
myJSArray(curRow++) = 'banana';
</script>
 
Obviously if you are dealing with multi-dimentional arrays you will need to adjust the above code accordingly.
 
FoxWeb Support Team
support@foxweb.com
Sent by Sunil Shah on 04/23/2002 02:17:39 AM:

Can I mix javascript arrays functionality with visual foxpro arrays functionality ?

Any examples I can look at ?

TIA

Sunil Shah