Powershell Unique Selections for Multiple Combo Boxes

I am currently working on a powershell script that will use 4 combo box controls. I would like for them to all use the same data source whether it be an array or just a .txt file. I would like for each selection to be unique so that no 2 combo boxes can
have the same item selected. Is there a way to hide the item selected in the data source so the other combo boxes do not even have the option to select it and then when the user changes the item in one of the combo boxes the item is available again? 

What I am looking do do is have a list of values (T1111,T1112,T1113,T1114) to be selected from by 4 combo boxes. Each value can only be selected once so if one combo box picks T1111 the other 3 do not have that option in its selection. So far I reload the
combo boxes ever time a selection is made and remove the option from the array, but I was looking to see if there is a better way. As it currently stands, getting distinct values isn't working.
Code snippet to remove item from array:
function Get-DataSource
$array = @("T1111", "T1112", "T1113", "T1114")
$combo1 = $combobox1.SelectedItem.ToString()
$combo2 = $combobox2.SelectedItem.ToString()
$array = $array | Where-Object -FilterScript { $_ -ne $combo1 }
$array = $array | Where-Object -FilterScript { $_ -ne $combo2 }
return $array
I apologize for not uploading my code.
function OnApplicationLoad {
#Note: This function is not called in Projects
#Note: This function runs before the form is created
#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
#Important: Form controls cannot be accessed in this function
#TODO: Add modules and custom code to validate the application load
return $true #return true for success or false for failure
function OnApplicationExit {
#Note: This function is not called in Projects
#Note: This function runs after the form is closed
#TODO: Add custom code to clean up and unload modules when the application exits
$script:ExitCode = 0 #Set the exit code for the Packager
#endregion Application Functions;2
# Generated Form Function
function Call-tenet_psf {
#region Import the Assemblies
[void][reflection.assembly]::Load('mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#region Generated Form Objects
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$combobox2 = New-Object 'System.Windows.Forms.ComboBox'
$combobox1 = New-Object 'System.Windows.Forms.ComboBox'
$buttonOK = New-Object 'System.Windows.Forms.Button'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects
# User Generated Script
function OnApplicationLoad {
#Note: This function is not called in Projects
#Note: This function runs before the form is created
#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
#Important: Form controls cannot be accessed in this function
#TODO: Add modules and custom code to validate the application load
return $true #return true for success or false for failure
function OnApplicationExit {
#Note: This function is not called in Projects
#Note: This function runs after the form is closed
#TODO: Add custom code to clean up and unload modules when the application exits
$script:ExitCode = 0 #Set the exit code for the Packager
$FormEvent_Load={
#TODO: Initialize Form Controls here
Load-ComboBox $combobox1 (Get-DataSource)
Load-ComboBox $combobox2 (Get-DataSource)
function Get-DataSource
$array = @("T1111", "T1112", "T1113", "T1114")
$combo1 = $combobox1.SelectedItem.ToString()
$combo2 = $combobox2.SelectedItem.ToString()
$array = $array | Where-Object -FilterScript { $_ -ne $combo1 }
$array = $array | Where-Object -FilterScript { $_ -ne $combo2 }
return $array
#region Control Helper Functions
function Load-ComboBox
<#
.SYNOPSIS
This functions helps you load items into a ComboBox.
.DESCRIPTION
Use this function to dynamically load items into the ComboBox control.
.PARAMETER  ComboBox
The ComboBox control you want to add items to.
.PARAMETER  Items
The object or objects you wish to load into the ComboBox's Items collection.
.PARAMETER  DisplayMember
Indicates the property to display for the items in this control.
.PARAMETER  Append
Adds the item(s) to the ComboBox without clearing the Items collection.
.EXAMPLE
Load-ComboBox $combobox1 "Red", "White", "Blue"
.EXAMPLE
Load-ComboBox $combobox1 "Red" -Append
Load-ComboBox $combobox1 "White" -Append
Load-ComboBox $combobox1 "Blue" -Append
.EXAMPLE
Load-ComboBox $combobox1 (Get-Process) "ProcessName"
#>
Param (
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
[System.Windows.Forms.ComboBox]$ComboBox,
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
$Items,
   [Parameter(Mandatory=$false)]
[string]$DisplayMember,
[switch]$Append
if(-not $Append)
$ComboBox.Items.Clear()
if($Items -is [Object[]])
$ComboBox.Items.AddRange($Items)
elseif ($Items -is [Array])
$ComboBox.BeginUpdate()
foreach($obj in $Items)
$ComboBox.Items.Add($obj)
$ComboBox.EndUpdate()
else
$ComboBox.Items.Add($Items)
$ComboBox.DisplayMember = $DisplayMember
$combobox1_SelectedIndexChanged={
#TODO: Place custom script here
Load-ComboBox $combobox2 -Items (Get-DataSource)
$combobox2_SelectedIndexChanged={
#TODO: Place custom script here
Load-ComboBox $combobox1 -Items (Get-DataSource)
# --End User Generated Script--
#region Generated Events
$Form_StateCorrection_Load=
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
$Form_Cleanup_FormClosed=
#Remove all event handlers from the controls
try
$combobox2.remove_SelectedIndexChanged($combobox2_SelectedIndexChanged)
$combobox1.remove_SelectedIndexChanged($combobox1_SelectedIndexChanged)
$form1.remove_Load($FormEvent_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
catch [Exception]
#endregion Generated Events
#region Generated Form Code
$form1.SuspendLayout()
# form1
$form1.Controls.Add($combobox2)
$form1.Controls.Add($combobox1)
$form1.Controls.Add($buttonOK)
$form1.AcceptButton = $buttonOK
$form1.ClientSize = '614, 289'
$form1.FormBorderStyle = 'FixedDialog'
$form1.MaximizeBox = $False
$form1.MinimizeBox = $False
$form1.Name = "form1"
$form1.StartPosition = 'CenterScreen'
$form1.Text = "Form"
$form1.add_Load($FormEvent_Load)
# combobox2
$combobox2.FormattingEnabled = $True
$combobox2.Location = '123, 92'
$combobox2.Name = "combobox2"
$combobox2.Size = '121, 21'
$combobox2.TabIndex = 2
$combobox2.add_SelectedIndexChanged($combobox2_SelectedIndexChanged)
# combobox1
$combobox1.FormattingEnabled = $True
$combobox1.Location = '123, 64'
$combobox1.Name = "combobox1"
$combobox1.Size = '121, 21'
$combobox1.TabIndex = 1
$combobox1.add_SelectedIndexChanged($combobox1_SelectedIndexChanged)
# buttonOK
$buttonOK.Anchor = 'Bottom, Right'
$buttonOK.DialogResult = 'OK'
$buttonOK.Location = '140, 254'
$buttonOK.Name = "buttonOK"
$buttonOK.Size = '75, 23'
$buttonOK.TabIndex = 0
$buttonOK.Text = "&OK"
$buttonOK.UseVisualStyleBackColor = $True
$form1.ResumeLayout()
#endregion Generated Form Code
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $form1.ShowDialog()
} #End Function
#Call OnApplicationLoad to initialize
if((OnApplicationLoad) -eq $true)
#Call the form
Call-tenet_psf | Out-Null
#Perform cleanup
OnApplicationExit

Similar Messages

  • Populate 2nd combo box based on value selected in 1st combo box

    I am still using Acrobat 6 though I may be upgrading soon to Acrobat 8. I have a form with two combo boxes, the first "state" has values of MN and WI. Based on which value the user picks I would like to populate a "county" combo box with lists of counties that we deal with.
    Thanks,
    Gene

    One can set the option and export value using an arry:<br /><br />// document level script<br />// Master List of Lists <br />// Each entry in this object listeral is the name of a State <br />//Manually enter the State Names into the state field combo box <br />// The associated value is the item list, where each item is a name value pair, [<County> and [county code, zip code]] <br /><br />// state: ["county name", ["county code", "zip code"]]<br />var oStateNames = {MN: [["-", ["", ""] ], <br />                       ["St. Louis", ["MNStl", "55001"] ], <br />                       ["Carlton", ["MNSCrl", "55002"] ], <br />                       ["Pine", ["MNPin", "55003"] ],<br />                       ["Cook", ["MNCok", "55004"] ] <br />                       ], <br />                   WI: [["-", [" ", " "] ],<br />                        ["Douglas", ["WIDou", "55005"] ] ,<br />                        ["Bayfield", ["WIBay", "55006"] ],<br />                        ["Burnette", ["WIBur", "55007"] ],<br />                        ["Ashland", ["WIAsh", "55008"] ]<br />                       ]<br />                     }; <br /><br />//SetCountyEntries() on keystroke entry in state field <br />function SetCountyEntries() <br />{ <br />   if(event.willCommit) <br />   { <br />      // Get the new counties list from the Master List <br />      // Since the selection is being committed, <br />      // event.value contains the State name <br />      var lst = oStateNames[event.value]; <br />      // Clear the county list if there are no counties for the selected state <br />      this.getField("ee.address.county").clearItems();<br />      this.resetForm(["ee.address.code", "ee.address.zip"]);<br />      if( (lst != null) && (lst.length > 0) )<br />           this.getField("ee.address.county").setItems(lst); // set opiton and export value<br />   } <br />} <br />//  end document level script<br /><br />For the combo box "ee.address.county" one can create an array from the export value to populate the county code and zip code<br /><br />// custom keystroke for county combo box<br />if(event.willCommit & event.value != "") {<br />// split county and zip codes<br />var aCodes = this.getField(event.target.name).value.split(",");<br />this.getField("ee.address.code").value = aCodes[0];<br />this.getField("ee.address.zip").value = aCodes[1];<br />}<br />// end custom key stroke code

  • How to Add/Concatenate to a text field, values selected in a combo box

    I have a combo box form field that allows the user to select a value from a list and click on an Add button. The Add button should add/concatenate the vaue selected to a text field in order to create a list of values selected. I'm not sure how to do this using Javascript in Acrobat? I know I need to add the javascript to the Add button's Mouse Up action. Any help would be greatly appreciated. Thanks!

    Thanks so much - it works!
    >>> "Gilad D (try67)" <[email protected]> 9/25/2013 9:16 AM >>>
    Re: How to Add/Concatenate to a text field, values selected in a combo box created by Gilad D (try67) ( http://forums.adobe.com/people/try67 ) in JavaScript - View the full discussion ( http://forums.adobe.com/message/5712118#5712118 )
    Let's say the text field's name is "Text1", and the combo is called "Combo1". You can then use this code as the MouseUp script of the Add button:
    var f1 = this.getField("Text1");
    var f2 = this.getField("Combo1");
    if (f1.value=="") f1.value = f2.value;
    else f1.value = f1.value + ", " + f2.value;
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5712118#5712118
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5712118#5712118
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5712118#5712118. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in JavaScript by email ( mailto:[email protected].com ) or at Adobe Community ( http://forums.adobe.com/choose-container!input.jspa?contentType=1&containerType=14&contain er=3286 )
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Multiple combo boxes

    Hi all,
    New to this forum. Hoping someone might be able to help or
    point me in the right direction. I`m trying to use three combo
    boxes, with each combination of choices taking the user to a
    different frame. Is this possible? Any hints of where to start?
    Many thanks in advance!

    Thanks for your reply. I have now got as far as being able to
    tell which item has been selected from two combo boxes, but can`t
    seem to use them outside of this function. I tried declaring as
    global variables but still can`t get it to work.
    Heres my code:
    var myComboBox1:mx.controls.ComboBox;
    myComboBox1.removeAll();
    myComboBox1.addItem("--Choose--", "Choose");
    myComboBox1.addItem("one", "1");
    myComboBox1.addItem("ten", "10");
    myComboBox1.addItem("twenty", "20")
    myComboBox2.removeAll();
    myComboBox2.addItem("--Choose--", "Choose");
    myComboBox2.addItem("a", "a1");
    myComboBox2.addItem("b", "b10");
    myComboBox2.addItem("c", "c20")
    //Check taking the correct value from combo box 1
    myComboBox1.addEventListener("change", doChange1);
    function doChange1 (evt1){
    trace ("Combo box 1 " + evt1.target.value);
    _global.varResult_1=evt1.target.value
    //Check taking the correct value from combo box 2
    myComboBox2.addEventListener("change", doChange2);
    function doChange2 (evt2){
    trace ("Combo box 2 " + evt2.target.value);
    varResult_2=evt2.target.value
    //Try to choose which frame to go to depending on both combo
    boxes
    function checkResult(){
    //varResult_1=myComboBox1.value
    //varResult_2=myComboBox2.value
    if((_global.varResult_1==10)&(_global.varResult_2==b10)){
    gotoAndStop(10)
    function doChange(evt1) {
    trace("Value changed to 1" + _global.varResult_1);
    trace("Value changed to 2" + evt2.target.value);
    checkResult()
    Can anyone give me any hints of where I am going wrong or
    where to look for help?
    Thanks again

  • Can images be used as selections in a combo box in Acrobat 9 Pro?

    Can images be used as selections in a combo box in Acrobat 9 Pro? I only see options for text choices when I look at the combo box properties. Basically, I want to click the drop-down and see images (small logos) from which to choose as opposed to text choices.
    I'm grateful for any thoughts on this.

    Have a look at the PO sample that ships with Designer. It shows the provinces or states based on the country that you choose. Look in the Designer install folder under EN/Samples/Forms/Purchase Order/Dynamic Interactive

  • While selecting value from combo box in one frame, based on the selection..

    Hi friends,
    can someone help me out on a issue as it follows:-
    iam developing an application where Iam using xsl,html,javascript and xml.
    There is no existense of Database at all. data is read from xml.
    now,
    In a window there are 3 frames. In the 1st frame combo box is there.
    Based on the selection in the combo box data will be displayed in the 2nd frame.
    now onchange or onselect methods not giving the expected result.
    actually,in the the xsl which is having 3 frames,the 1st and 3rd frame
    calling src="abc.xml" and src="abc.xml"which are static.
    but in the 2nd frame the data need to be changed dynamically.
    I have given frame name="frame_ExchangeDetails2" rows="3%" src="cc_marketWatch_02.xml"/>
    usually data dynamically comes from database.but here i have to refer xml file
    something like [window.href.location="abc.xml"]
    but the problem is when you refer supose:-
    <frame name="frame_ExchangeDetails2" rows="3%" src="cc_marketWatch_02.xml"/>
    the frame is having static page,though there are functions in javascript which are called in onload and onchange.which are not working.
    I have tried putting if condition like:-
    if(document.abc.fieldname.value=='6'
    {   window.location.href = "cc_custLookUpData-mobileno.xml";   
    so that it could go to the repective page.
    but it is not working.
    so what should i do if I select from combo box in one frame and based on the selection xml/html page will be displayed in the 2nd frame.
    if anybody has google account i can forward the zip file so it will be easier to understand.
    Regards
    Message was edited by:
    Postqueries
    Message was edited by:
    Postqueries

    If you have rights to modify tabular model then, you can create a measure in your Tabular model which returns previous week and then use this measure in Pivot Table.
    Thanks,
    Sagar K 
    (Blog: http://datamazik.blogspot.in/)

  • Custom paint for a combo box?

    Is there a document anywhere that describes all the parts you need to paint for a combo box? We have a particular need for a special presentation, but combo boxes can be rather complicated to paint all the parts correctly.
    TIA!

    don't know of a document, but an example of a (color) modified comboBox is here
    [http://forums.sun.com/thread.jspa?forumID=57&threadID=5283094]
    you just have to copy all of the code (it does run)

  • Tooltip for the Combo Box

    Hi Everyone,
    Tooltip is not coming for the Combo Box in Forms 10g!! Is there any specific reason why is it not available??
    With Regards,
    Yathish

    Its bug 1879328 I would think.

  • Multiple selection in a Combo Box of a JOptionPane.

    Hello,
    Can we have multiple selection of the items in a Combo Box of a JOptionPane?
    An example will be highly appreciated.
    Thanks.

    Use a JList for multiple selection.

  • Connecting selections in a combo box to specific information in an FDF file

    Hi!  I am trying to create a PDF with form fields that allow the user to select an option in a combo box and data for that selection is pulled into the document.  The information is a description of the option and I am trying to create the combo box with multiple options, but there are very distinct descriptions for each selection.  Does anyone have any guidance?  I am not literate in terms of programming, and though I work with Adobe products all day, I haven't the slightest idea how to link an option to a specific set of data, or if it is even a possibility.  I am working in Adobe Pro 9.

    Have a look at the PO sample that ships with Designer. It shows the provinces or states based on the country that you choose. Look in the Designer install folder under EN/Samples/Forms/Purchase Order/Dynamic Interactive

  • How to display data in a grid after selecting topic from combo box?

    could someone help me out? i'm displaying a combo box (about
    20 items) vertically. when user selects one of these items, i'd
    like for information regarding that choice to be displayed in my
    data grid. thanks - Karl from Kansas

    If you have the following:
    <mx:ComboBox id="combo_box" dataProvider="{users}"
    labelField="user_name" change="show_details(event)"
    ></mx:ComboBox>
    <mx:DataGrid id="data_grid" >
    <mx:columns>
    <mx:DataGridColumn headerText="Name"
    dataField="user_name"/>
    <mx:DataGridColumn headerText="email"
    dataField="email"/>
    </mx:columns>
    </mx:DataGrid>
    private function show_details(evt:Event):void {
    data_grid.dataProvider = evt.currentTarget.selectedItem
    This assumes that your combo box data has a user_name and
    email property value. Substitute your property values where needed.
    Vygo

  • How do I correctly use Macro Builder to have a form auto select a TAB depending on a value selected in a combo box?

    I am working in access 2013 to update a database first created in Access 2003. It has been saved as an accdb but I have the same problem in earlier versions.
    I have a Tab Control subform in my MainDataEntry form which has 5 different tabs. Each Tab has its own set of text boxes and combo boxes for data entry. At the top of the MainDataEntry form there is a Text box [Text393], which has a drop down with
    the 5 TAB names, [Mobile Device],[Computer],[Loose Media],[Network] and [Original Device]. When I select one of these values in the Text box, I would like to automatically set focus on the first Textbox or ComboBox inside the corresponding TAB.
    I have tried to do this using the MacroBuilder inside the "After Update" Property for the Text or Combo box that is on the MainDataEntry Form using "If" and "Else If" statements for the "GoToControl" action, however
    I seem to be able to only get one Tab to work. I have tried several different variations of this, putting the If statement first and the action argument second...putting all arguments inside a group, or not grouped....nothing seems to work. What am I
    doing wrong?
    EXAMPLE:
    If [Text393]=[Mobile Device] Then
        GoToControl
             Control Name   Combo471
    Else If [Text393]=[Computer] Then
        GoToControl
    Control Name   Bios_Date
    Else If [Text393]=[Loose Media] Then
        GoToControl
             Control Name   Combo659
    Else If [Text393]=[Network] Then
        GoToControl
             Control Name   User Name
    Else If [Text393]=[Original Device] Then
        GoToControl
             Control Name   Combo814
    End If

    In the Macro Builder's AfterUpdate event for [Text393]:
    GoTo Control
      Control Name =Forms!MainDataEntry.Controls(Text393.Value).Name
    To ensure that the first control on each tab receives the focus, set that control's Tab Index property to zero (0).

  • How do I make a pdf that can submit a form to the email selected in a combo box?

    I'm trying to be able to have the user of a pdf I'm creating, select an email in a combo box and then hit send and have it send to that email address that was selected.
    Thanks for the help!

    Hi,
    I don't think (but may be wrong) that you can do that within InDesign. At the very least, you could draw the form within InDesign but I guess that the interactivity between the list selection and the mail action should be achieved with Acrobat Scripting or LiveCycle Designer if you have it.
    FWIW,
    Loic

  • Linking multiple combo boxes

    Hello,
    I need some help with something that I am having trouble wrapping my head around. I am in the midst of creating some forms for our office that were originally MS Word files that have since been converted to PDF's. On these forms (which are now compiled into one PDF) there is a field for a name and one fore a licence number. What I would like to do (if possible) is have a drop down combo box with the pilots name. Once the name has been selected, it automatically populates the pilots name and licence number on the subsequent forms.
    Is this possible and if so, does someone have a tutorial on how to do this? I have not had much luck looking online but thought perhaps someone on here may have tired something similar before.
    Thanks.
    Chris

    Yes it's possible. For some help, check out: http://www.acrobatusers.com/tutorials/2007/js_list_combo_livecycle/
    There is a part 2 to this article that may help as well.
    George

  • Combo Box Selection to Change Selection in another Combo Box

    I'm pretty familiar with excel and VBA, but when it comes to Adobe Acrobat, I am lost with Javascript.
    I am creating a form.
    My first field is a combo box named: Rent.booth
    My second field is also a combo box named: County.booth
    I need to know where and how I would implement a java command that states that if Rent.booth = Rent, then County.booth automatically = No.
    If No is selected for Rent.booth, then allow the user to choose any of the 3 values.
    Combo Box Options for Rent.booth:
    Select One
    Rent
    No
    Combo Box Options for County.booth:
    Select One
    Yes
    No
    Any leads would be appreciated.  So far I've only seen the Combo Box to Text box solutions, nothing for Combo box to Combo Box.

    You'll get the best help with Javascript in the Acrobat Scripting forum.

Maybe you are looking for