IBM i Global

IBM i 

Connect, learn, share, and engage with IBM Power.


#Power
 View Only
  • 1.  HAScript pop-up with radio button options?

    Posted Thu August 22, 2024 02:31 PM

    Has anybody figured out if HAScript can pop-up a radio button box with multiple options?

    Something as simple as:
    Option1
    Option2
    Option3

    Then set $Option$ = based on the answer.

    I figured out I can combine multiple prompts that only accept a single character to act like a pseudo-radio box, but it doesn't prevent users from selecting more than one option. Any help would be appreciated!



    ------------------------------
    Greg Cornett
    ------------------------------

    #IBMiAccessClientSolutions


  • 2.  RE: HAScript pop-up with radio button options?

    Posted Thu September 12, 2024 09:22 AM

    Answering my own question, hoping it may help somebody else in the future.  There does not appear to be a radio button prompt, but I did figure out a dirty way to create a pop-up that offers multiple selections.

    At the top of your HAScript, if you set promptall="true", any prompts you set in the script will all appear together in one box.  It isn't pretty, and you can't give the combined pop-up a title, but it does work.

    This script gives the user three different website options, and then launches the website they choose in Chrome.  I set the answer field to only allow one character in each selection box.  It doesn't really matter what character they enter to indicate their selection, since the logic checks to see if a selection ISN'T blank.  Unfortunately the programming limitations don't prevent the user from selection multiple options.  I'm sure you could use a variable update as a counter to see if they selected more than one option, but for my purposes that didn't matter.

    <HAScript name="Multiple Choice" description="Multiple Choice" timeout="60000" pausetime="300" promptall="true" blockinput="true" author="Greg Cornett" creationdate="September 05, 2024" supressclearevents="false" usevars="true" ignorepauseforenhancedtn="true" delayifnotenhancedtn="0" ignorepausetimeforenhancedtn="true" continueontimeout="false">
     
        <vars>
          <create name="$Option1$" type="string" value="" />
          <create name="$Option2$" type="string" value="" />
          <create name="$Option3$" type="string" value="" />
        </vars>
     
        <screen name="Screen1" entryscreen="true" exitscreen="true" transient="false">
            <description >
                <oia status="NOTINHIBITED" optional="false" invertmatch="false" />
            </description>
            <actions>
                <prompt name="&apos;Google&apos;" description="&apos;X&apos;" row="0" col="0" len="1" default="" clearfield="false" encrypted="false" movecursor="true" xlatehostkeys="true" assigntovar="$Option1$" varupdateonly="true" required="false" title="&apos;Select One (X)&apos;" />
                <prompt name="&apos;Yahoo&apos;" description="&apos;X&apos;" row="0" col="0" len="1" default="" clearfield="false" encrypted="false" movecursor="true" xlatehostkeys="true" assigntovar="$Option2$" varupdateonly="true" required="false" title="&apos;Select One (X)&apos;" />
                <prompt name="&apos;Microsoft&apos;" description="&apos;X&apos;" row="0" col="0" len="1" default="" clearfield="false" encrypted="false" movecursor="true" xlatehostkeys="true" assigntovar="$Option3$" varupdateonly="true" required="false" title="&apos;Select One (X)&apos;" />
     
                <if condition="$Option1$ != &apos;&apos;" >
    <runprogram exe="&apos;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&apos;" param="&apos;http://www.google.com&apos;" wait="false" assignexitvalue="" />
                </if>
                <if condition="$Option2$ != &apos;&apos;" >
    <runprogram exe="&apos;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&apos;" param="&apos;http://www.yahoo.com&apos;" wait="false" assignexitvalue="" />
                </if>
                <if condition="$Option3$ != &apos;&apos;" >
    <runprogram exe="&apos;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&apos;" param="&apos;http://www.microsoft.com&apos;" wait="false" assignexitvalue="" />
                </if>
     
            </actions>
            <nextscreens timeout="0" >
            </nextscreens>
        </screen>
    </HAScript>


    ------------------------------
    Greg Cornett
    ------------------------------