View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
Dear Joe,

Although you seem to have got the answer you need already, I thought I would just drop you a note anyway.

I found that an empty checkbox returns nothing and a checked checkbox returns "on".

Thus, here I have a line of checkboxes where clients mark the languages they are interest in:

<TR>
    <TD ALIGN="right" WIDTH="110">Language&nbsp;</TD>
    <TD ALIGN="right" WIDTH="35">D</TD>
    <TD ALIGN="left" WIDTH="35"><INPUT TYPE="checkbox" NAME="LangD"></TD>
    <TD ALIGN="right" WIDTH="35">E</TD>
    <TD ALIGN="left" WIDTH="35"><INPUT TYPE="checkbox" NAME="LangE"></TD>
    <TD ALIGN="right" WIDTH="35">F</TD>
    <TD ALIGN="left" WIDTH="35"><INPUT TYPE="checkbox" NAME="LangF"></TD>
    <TD ALIGN="right" WIDTH="35">I</TD>
    <TD ALIGN="left" WIDTH="35"><INPUT TYPE="checkbox" NAME="LangI"></TD>
    <TD ALIGN="right" WIDTH="35">S</TD>
    <TD ALIGN="left" WIDTH="35"><INPUT TYPE="checkbox" NAME="LangS"></TD>
    <TD ALIGN="right" WIDTH="35">V</TD>
    <TD ALIGN="left" WIDTH="35"><INPUT TYPE="checkbox" NAME="LangV"></TD>
    <TD ALIGN="right" WIDTH="35">&nbsp;</TD>
    <TD ALIGN="left" WIDTH="35">&nbsp;</TD>
</TR>

And here I establish the filter:

* Establish Language Filter:

lcLang = ""
lcLangHeader = ""

IF ALLTRIM(Request.Form('LangD')) == "on"
    lcLang = ", 'D'"
    lcLangHeader = "German "
ENDIF
IF ALLTRIM(Request.Form('LangE')) == "on"
    lcLang = lcLang + ", 'E'"
    lcLangHeader = lcLangHeader + "English "
ENDIF

etc.

If you wanted to use .T. or .F. , something like

IF ALLTRIM(Request.Form('LangD')) == "on"
    lcLangD = .T.
ELSE
                lcLangD = .F.

ENDIF

would probably do the trick.

That's it!

All the best.

John


Sent by Joe Goldsmith on 03/20/2002 08:23:35 AM:
If a field type is logical and I use a checkbox on a form for input, how do I use VFP to identify if it is checked or not and then store T or F as the field value please?

I am using for the form field:

<INPUT TYPE="checkbox" NAME="home" VALUE="<%=Request.Form("home")%>">

and then storing the result in:

M.home = Request.Form('home')

before inserting the response into the table field, "home".

Many thanks,

Joe