On 1/12/06, Peter Vidal <Peter_Vidal@xxxxxxxx> wrote:
> Hi list!
>
> I am using this:
>
>         <input TYPE="checkbox" NAME="rating">Rating based on Last Year
> Shipments Amount
>
> But it is always true, no matter if I check the box or not.  I read that
> the default Boolean value for the checkbox is TRUE.  Do I need to force it
> to be FALSE first?  May sound dumb but I though that by checking the box,
> I was turning the value to TRUE, not that the default is always TRUE.
>
> What is happening with the checkbox value?

Check out this little tutorial I found about how checkboxes work; I
think you have a misunderstanding.
http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_CHECKBOX.html

A checkbox isn't a boolean variable, it has a name and possible a
value, both of which are loaded into the checkbox.  The value is
distinct from the name, and is not required.  For instance ...
    <input type="checkbox" name=TypeSel value=SCALL>
creates a checkbox with name of TypeSel and value 'SCALL'.

There can be multiple checkboxes on a form with the same name, as long
as they have different values.
    <input type="checkbox" name=TypeSel value=SCALL>
    <input type="checkbox" name=TypeSel value=SHRMP>
    <input type="checkbox" name=TypeSel value=FINFISH>

The checkbox also has an attribute CHECKED, which can be set on when
the form displayed by including the keyword CHECKED in the HTML
definition, such as..
    <input type="checkbox" name=TypeSel value=SHRMP CHECKED>

When the form is submitted, the name/value pair of all CHECKED
checkboxes are returned by the form to the program, with the value
that was originally loaded until them.  If the checkbox is not
checked, it will not be returned by the form.  If there is no value,
then only the name is returned.

In your situation, it appears that zhbgetvar returns blank if the
variable doesn't exist, and that when RPG evaluates blank into a
Boolean variable, the non-NULL value becomes TRUE.
    eval      Boolean  = ZhbGetVar('rating')
Will evaluate into TRUE (or *ON) every time.

Try ...
    eval RatingBoolean = *OFF
    eval      RatingValue = ZhbGetVar('rating')

    if RatingValue =  'rating'
    eval RatingBoolean = *ON
    endif

Hope this helps ...
--
Tom Jedrzejewicz
tomjedrz@xxxxxxxxx


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.