View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
The Request.Form method is read only.  You can't set the value of form fields this way.  In order to set the value of form fields, you must do so in the HTML that gets sent out.  In this particular example, you are actually setting the value to be equal to what the user already submitted.  My guess is that you want something like this:

<%
LOCAL sum, num1, num2
num1 = VAL(Request.Form("num1"))
num2 = VAL(Request.Form("num2"))
sum = num1 + num2
%>
<HTML>
<BODY>
<FORM ACTION="sum.fwx" METHOD="post">
<INPUT NAME="num1" VALUE="<%=M.num1%>">+
<INPUT NAME="num2" VALUE="<%=M.num2%>">=
<%=M.sum%><BR>
<INPUT TYPE="submit" VALUE="Add">
</FORM>
</BODY>
</HTML>

FoxWeb Support Team
support@foxweb.com email
Sent by jfr on 11/02/2007 04:24:35 PM:
 I must be missing something very basic, but I can't figure out how to set a form field's value from within FoxWeb code. The following shows my miserable attempts. 
<HTML>
<BODY>
<FORM ACTION="sum.fwx" METHOD="post">
<INPUT NAME="num1" VALUE="<%=Request.Form("num1")%>">+
<INPUT NAME="num2" VALUE="<%=Request.Form("num2")%>">=
<INPUT NAME="sum"  VALUE="<%=Request.Form("sum")%>"><BR>
<INPUT TYPE="submit" VALUE="Add">
</FORM>
<%
IF Request.Form("num1") == "" OR Request.Form("num2") == ""
    sum = ""
ELSE
    val1 = VAL(Request.Form("num1"))
    val2 = VAL(Request.Form("num2"))
    sum = STR(val1 + val2)
ENDIF
Request.Form("sum") = sum
*Response.AddHeader("sum",sum) && doesn't work either
%>
</BODY>
</HTML>