Date:  11/02/2002 12:32:08 PM Msg ID:  000984
From:  Gene Gerard Thread:  000947
Subject:  Js Var to Fp Var Still Won\'t Work
The solution you sent does not help with what I'm trying to do:
 
Previously you showed  how
 
  MyJSVariable = <%=M.MyVFPVariable%>
 
This works fine.
 
I want to copy the value of JS variable into a FoxPro variable on the same page . . . ( whereas your example (below) transfers the value to a different page . . . and I can't get that to work either.)
 
Then a routine would copy that value into a free table field. I've tested my code by introducing static values for the variables at various script locations and the process works ok and saves the data . . . except when trying to copy the JS Variable to FP Variable.
 
I've tried the reverse of the above with:
 
  <%M.MyVFPVariable=%>=MyJSVariable
 
and get a Syntax Error message because the above line translates to:
 
  M.MyVFPVariable=
 
 
I've worked on this one problem for over 2 weeks now and also tried putting the:
 
M.MyVFPVariable = Request.Form('M.MyVFPVariableDataEntryBox')
 
in my code but I notice that in your CONT_EDIT.FWX example, the FoxWeb code precedes the HTML code. Are there some pre-processing issues here that I'm not aware of?
 
If need be, I can send you a zip file of my files.
 
Thank you in advance,
 
Gene
 
Sent by FoxWeb Support on 10/23/2002 12:24:48 AM:
You can do so by automatically generating a URL and sending the information to the browser:
 
<script language="javascript">
var totPrice = totItems * price;
window.location.href = 'MyScript.fwx?cost=' + totPrice;
</script>
 
When the above JS code is executed on the browser it:
  1. calculates the value of totPrice
  2. Dynamically creates a URL that points to script MyScript.fwx and includes totPrice in the queryString as a field named "cost".
  3. Automatically redirects the browser to the above URL.