Alpha Video Training
Results 1 to 12 of 12

Thread: Dialog Check-Box

  1. #1
    Member
    Real Name
    Wesley Edwards
    Join Date
    Aug 2008
    Posts
    37

    Default Dialog Check-Box

    I've a checkbox on a dialog form. I am having trouble showing it's state as "checked" on form load.

    Aside from that the checkbox works great.

    I've looked through the HTML of the page without the checkbox checked and with the checkbox checked and the difference is that the checked box has the additional option "checked=True".

    How do I get that option using the Alpha5 software so that it will show up on form load?

  2. #2
    "Certified" Alphaholic NoeticCC's Avatar
    Real Name
    Andrea Gill
    Join Date
    Nov 2007
    Location
    Golcar, West Yorkshire, UK
    Posts
    2,069

    Default Re: Dialog Check-Box

    Not 100% sure but I think true in alpha5/xbasic is .t. not TRUE...

    Not had great luck with checkboxes myself though so might be very wrong!

  3. #3
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,562

    Default Re: Dialog Check-Box

    In the control properties box ( ie when you add the control to the dialog)

    if the Data type is character, there is a initial value property to set

    if the Data type is logical, there is an initial state property to set
    Last edited by Al Buchholz; 12-15-2008 at 06:06 PM. Reason: add image..
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  4. #4
    Moderator drgarytraub's Avatar
    Real Name
    Dr. Gary Traub
    Join Date
    May 2000
    Location
    Boca Raton, FL
    Posts
    2,768

    Default Re: Dialog Check-Box

    Al,

    Thank you for this. Up until your explanation, I could not get them to work. Now I understand and they are very cool!

    Gary

  5. #5
    Member
    Real Name
    Sally Gudbrandsen
    Join Date
    Mar 2009
    Posts
    6

    Default Re: Dialog Check-Box

    please help. i still can't get logical checkboxes to work.

    Creating a dialog, In the control properties box, Data type is set to logical,
    if i set the initial state to False, is see value="True" in the pagesource.
    Should this not be value="False"?

    (if i set the state to True i get (correctly) checked="checked" value="True")

    (i'm very new to anything web.
    i know i could create the above as character & set up T/F choices, but then is there any sense in having logical fields in a table?)

  6. #6
    Member
    Real Name
    Wesley Edwards
    Join Date
    Aug 2008
    Posts
    37

    Default Re: Dialog Check-Box

    The checkbox value of "true" or "false" doesn't represent that the box is checked or not. A checkbox can have a value of "banannas" and still work.

    The value= tag in pagesource does not represent the state/property of being checked or not being checked. I had trouble with this myself until I did some reading.

    Check out this tutorial:

    http://www.echoecho.com/htmlforms09.htm

  7. #7
    Member
    Real Name
    Sally Gudbrandsen
    Join Date
    Mar 2009
    Posts
    6

    Default Re: Dialog Check-Box

    Thank you for the echo link! and for your quick response,

    does this mean that something needs to be coded in order to deal with this as a logical data type?
    setting the initial state to False is misleading?

    A5 help:
    "CheckBox Properties
    Check boxes are appropriate when you want to set a True/False value into a logical field. The most important property for a check box control is the definition of its choices."
    is ambiguous (there are no choices for the value of a logical field).

    since i need to set choices, it would easiest to set this up as character?

    and then, is there any sense in having logical fields in a table?

    or another ? is - how to initialize the value of a checkbox to False?
    Last edited by gudbrand; 04-28-2009 at 03:18 PM. Reason: i meant false, not true

  8. #8
    Member
    Real Name
    Wesley Edwards
    Join Date
    Aug 2008
    Posts
    37

    Default Re: Dialog Check-Box

    I actually don't use logical check boxes myself. I do a conversion when I am evaluating the box, and for that I use the function convert_type(value, type) Type is a string value that represents a variable type. IE for logical (true/false) type would be "L".

    So in my code I have something that looks like this:

    if (convert_type(variable, "L") == .t.)
    ...

    The reason I don't use logical values is because I store my data as the "bit" data type in my database engine. A checkbox really is a logical "true/false" pair or you can also think of it as numeric "1/0" pair. I would stay away from character type because the character strings are less efficient and require more coding work. But remember that everything HTML is character based, even numeric values, so the application is always doing conversions.

    So how does the numeric type translate to this "bit" type? easily, the database engine does the work. I don't have to do any translation.

    Further, to set the default value, I use the database engine, not the alpha5 tools. I find it is much more efficient. By default, a record that does not exist will show as unchecked but your database engine can override that when the record is created(committed). I did it this way because like you, I was a bit frustrated with the handling of the checkbox in Alpha5, and for my applications it was not important to know what the default value was of a field until after a http POST operation.

    The other thing I typically do in Alpha is make my checkbox fields always assume "false". IE: insted of having a field that says "Denied" checked, I will have a field that says "Approved" unchecked. That way the application doesn't need any intelligence around the checkbox, other than to store it's value after a HTTP Post.

  9. #9
    Member
    Real Name
    Sally Gudbrandsen
    Join Date
    Mar 2009
    Posts
    6

    Default Re: Dialog Check-Box

    gosh you are helpful. forgive me, i know so little.
    my background is mainframe, so i understand a bit about bits (and efficient code)

    so, data type logical is held as character.
    in an AlphaFive dbf is blob the same as your reference to ""bit" data type"? i only need 1 bit?
    (do i need to learn about SQL too?)

    i need the check box to work just like i would think, and it sounds like you would think too,
    a 'logical' variable starts out being not true and not checked,
    and if the box gets checked, the variable gets set to true.
    (and on display, if true, show checked)

    there are various frustrated threads on this (if i could find them again).

    i'd like to have an a5wcmp dialog that does this.
    (perhaps AlphaSoft could put this out as a patch, rather than waiting for v10?
    (sorry, not sure how to use this message board at all, either searching or posting.))

    i'm afraid the development of this web app is going to go to a seasoned PHP/Java/SQL programmer.

  10. #10
    Member
    Real Name
    Sally Gudbrandsen
    Join Date
    Mar 2009
    Posts
    6

    Default Re: Dialog Check-Box

    ok. never mind about the blobs and bits. i see this is much easier to do than i was understanding. i knew i must be missing something.

    still wondering though - are you using SQL databases?

  11. #11
    Member
    Real Name
    Wesley Edwards
    Join Date
    Aug 2008
    Posts
    37

    Default Re: Dialog Check-Box

    I am using MS SQL server 2005 to store my data.

  12. #12
    Member
    Real Name
    Sally Gudbrandsen
    Join Date
    Mar 2009
    Posts
    6

    Default Re: Dialog Check-Box

    Thank you very much for your help.

Similar Threads

  1. Dialog Box - Check Box
    By jacklcs in forum Application Server Version 8
    Replies: 4
    Last Post: 08-13-2007, 03:05 AM
  2. Filter Report using Check-Box List-Box xdlg
    By G Gabriel in forum Alpha Five Version 6
    Replies: 43
    Last Post: 02-12-2007, 07:54 PM
  3. Using check box-list box for multiple query
    By trackmanpete in forum Alpha Five Version 7
    Replies: 5
    Last Post: 01-30-2007, 04:15 PM
  4. X dialog Check Box selection
    By Tom Patten in forum Alpha Five Version 6
    Replies: 4
    Last Post: 12-22-2004, 11:52 AM
  5. Uncheck, Check box list box in XDailog
    By infomatic in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-22-2003, 09:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •