Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2012
    Location
    Huntsville, AL
    Posts
    379
    Provided Answers: 2

    Unanswered: Selecting Cancel on Input Box

    I have added a variable using 'Set Variable By User Input' (see screenshot below). It works very well but I am wanting skip all scripting if 'Cancel', rather than 'OK', is selected on the Input Box. What do I need to do to make this work? I know how to do it if I select 'Cancel' on a form, I just do not understand how to do it if an Input Box is used.
    Thanks,
    Daryl G
    Attached Thumbnails Attached Thumbnails input box.jpg  

  2. #2
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    See attached file.

    Press GO.

    If you enter nothing and press cancel, it will do nothing.
    If you enter nothing and press OK, it will still do nothing.

    If you enter a value greater than 0 and press OK, it will display a message
    If you enter a value greater than 0 and press cancel, it will do nothing.

    Regards
    James
    Attached Files Attached Files

  3. #3
    Join Date
    Dec 2012
    Location
    Huntsville, AL
    Posts
    379
    Provided Answers: 2
    That was certainly quick!!! There are cases where the user will need the default value of 0, in fact, that will be the most frequent use - so, it must work if the value is 0. Only when 'Cancel' is selected is the case where it should do nothing. How can I do that?
    Daryl G

  4. #4
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    Try this... see attached.

    If the user enters nothing, press OK or Cancel, it will do nothing.
    If the user enters 0 and press OK, it proceeds.
    If the user enters 0 and press Cancel, it does nothing.

    Regards
    James
    Attached Files Attached Files

  5. #5
    Join Date
    Dec 2012
    Location
    Huntsville, AL
    Posts
    379
    Provided Answers: 2
    James,
    Thanks for your help. The behavior of the Cancel button on the Input Box is NOT what I am used to - rather than place an empty value when Cancel is selected, it places a 0 as the variable's value and this is causing me grief. I would prefer to have a default value of 0 appear in the Input Box but BD does not allow differentiation between simply clicking the OK button (which takes the default value of 0) or clicking the Cancel button as both courses of action produce IDENTICAL results. This should NOT be the case but it is... Selecting any positive integer greater than zero works fine and behaves properly on both the OK and Cancel buttons. I have tested several alternative treatments of the value (using default of 0 and alternating between selecting OK and Cancel) though nothing changes. I will keep experimenting to see if a solution exists.
    Daryl G

  6. #6
    Join Date
    Jul 2012
    Location
    Ireland
    Posts
    815
    Provided Answers: 17
    Hi Daryl
    You must set the default text of the User Input window to something like “Enter a value” as I've done above.

    If you set the default text to 0, then it will not work as expected because nothing entered will always revert to the default text. Which is 0, and not what you want as that's a value and not nothing.

    Regards
    James

  7. #7
    Join Date
    Dec 2012
    Location
    Huntsville, AL
    Posts
    379
    Provided Answers: 2
    I am not sure that I agree. Cancel and OK are two different animals. On selecting Cancel, the value should be "" not 0... this is how it works with Visual Basic and, most importantly, this is how it works when selecting Cancel according to Brilliant Database's User's Guide. I will retest using other approaches as I am not wanting or willing to do a work around because of a shortcoming with this program. This inconsistency is what aggravates me about some software programs.
    Thanks,
    Daryl G
    Last edited by fireant911; 03-21-13 at 12:16. Reason: corrected spelling error

  8. #8
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Have not had time to investigate but have you looked at the section "Pre-check of entered data" in the help PDF? This refers to form variables but may be option you could try. (Page 137 on my print out but that may be different on other printers)

  9. #9
    Join Date
    Jul 2012
    Posts
    94
    Provided Answers: 4
    I have edited Tubbritt's file. Is this ok?
    Attached Files Attached Files

  10. #10
    Join Date
    Dec 2012
    Location
    Huntsville, AL
    Posts
    379
    Provided Answers: 2
    MacHeuS,
    I set up several scenarios this morning so that I could observe how the program treats different values (blanks, 0, and any other positive integer). I then saw that the length command may work if no default value had been included in the Input Box (otherwise the default value is transferred when Cancel is selected). I also saw that when the program TRULY passed a value of nothing when Cancel was selected was when no default value was present. I reluctantly changed by scripting 'ever-so-slightly' to not include any default value since this is the ONLY time the Cancel command works properly with the Input Box. During the running of the script, if a value is encountered, the program executes the script; if not, it skips all of the code. It appears that you and I came to the same conclusion!!!

    For testing purposes: if a default value of, for example '7', is used this value is passed regardless of what button is selected (OK or Cancel). I am of the opinion that this is in error and the default value should ONLY be passed if OK is selected and when Cancel is selected, nothing should be passed... but that is not how it works in BD???
    Thanks,
    Daryl G

  11. #11
    Join Date
    Jul 2012
    Posts
    94
    Provided Answers: 4
    Yes i noticed now. I think, you've found a new bug

Posting Permissions

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