View Complete Thread | FoxWeb Forum Home
Date:    Msg ID:   
From:    Thread:   
First of all I want to make sure that you understand the distinction between FoxWeb and JavaScript code:  FoxWeb code is executed on the Web server, while the page is being dynamically created.  JavaScript code is executed on the browser AFTER the page is created by FoxWeb.  As a result, there's no way to "copy" the value one a JavaScript variable to a FoxWeb variable.  All you can do is force the browser to make a Web request, which will send the value of the JavaScript variable as a form or querystring field.
Regarding your comment about the example transferring the value to a different FoxWeb script, you can specify any script you want, but remember that there will still be an additional round-trip, since JavaScript code will not be executed until it is sent back to the browser.
Your example <%M.MyVFPVariable=%>=MyJSVariable will certainly not work, because everything within code delimiters must be a complete line of code.
I don't understand what you are trying to achieve with your second example:M.MyVFPVariable = Request.Form('M.MyVFPVariableDataEntryBox')
The argument passed to Request.Form should be the name of the HTML form field -- not a VFP variable.  If the VFP variable contains the name of the field, then it should not be in quotes.

FoxWeb Support Team email

Sent by Gene Gerard on 11/02/2002 12:32:08 PM:
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:
and get a Syntax Error message because the above line translates to:
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,
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;
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.