Page 1 of 1

how to use primalforms CE radio buttons

Posted: Fri Sep 07, 2012 9:46 am
by deviouz1
im looking for a script sample that covers using multiple groups of radio buttons. ive found similar things on the net but nothing that has really helped. i have a form with 3 groups of radio buttons, the 1st has 3 options, the 2nd has 4, and the 3rd has 2. i know im missing something because when i run it with the code all of the selections jump to the 1st option in the group. not sure how to explain that any better, i know its probably not very coherent. sorry.

basically my code is designed to create a list of specific servers. it takes 4 inputs, 3 of which make up the naming convention of our servers and the 4th to determine how to output the returned info.

the first is a text box where you enter the customer code.
the second is the farm type: prod, DR, or PPE
the third is the role: sql, backup, front end or app server
and the fourth is how i want the information output, whether onscreen to the rich text box or output to a file.

the script that does that is:

Code: Select all

	        $CCode = $null
	        $Role = $null        
	        $Farm = $null
	        $Ccode = read-host "What customer? (Please use 3 digit Customer code)"
	        $Role = read-host "What server role? (FE, AP, SQ)"
	        $Farm = read-host "which farm? (Prod=P, DR=S, PPE=T)"
	      If ( $Farm -ne $p -or $s -or $t )
	        {
	        $Farm = read-host "which farm? (Prod=p, DR=s, PPE=t)"
	        }
	        switch( read-host "[1] Display
	[2] Export to servers.txt
	Choose Option" )
	            {
	                1 {
	                Import-Module "CMDB" -Force
	                    Get-SPODCustomerServer | where {$_.CustomerCode -eq "$Ccode" -and $_.ServerRole -eq "$Role" -and $_.EnvironmentType -eq "$Farm"} | select servername | sort-object servername | out-gridview
	                  }
	                  
	                2 {
	                Import-Module "CMDB" -Force
	                    Get-SPODCustomerServer | where {$_.CustomerCode -eq "$Ccode" -and $_.ServerRole -eq "$Role" -and $_.EnvironmentType -eq "$Farm"} | Sort-object servername | %{"$($_.ServerName)"} | out-file servers.txt
	                    write-host "Server names have been exported to servers.txt" -ForegroundColor Yellow
	                  }
	            }
	

im trying to modify it to work in the form but i really dont understand how to set up the radio buttons and such.

how to use primalforms CE radio buttons

Posted: Fri Sep 07, 2012 10:20 am
by davidc
You need to group the radio buttons by using a container such as a Groupbox.

I recommend reading the following blog article:

http://www.sapien.com/blog/2011/07/08/p ... n-control/

David

how to use primalforms CE radio buttons

Posted: Fri Sep 07, 2012 10:33 am
by deviouz1
i did, i've attached a pic of the form i created. also, thats one of the articles i found but its not very specific, at least not specific enough to fit my needs.



Attached files

how to use primalforms CE radio buttons

Posted: Fri Sep 07, 2012 10:47 am
by davidc
Please zip and send the pff and the ps1 file to support@sapien.com. I will take a look at it to determine what the problem is.

David

how to use primalforms CE radio buttons

Posted: Fri Sep 07, 2012 11:55 am
by deviouz1
really, its just me doing something wrong or not doing something i should be. all i really need is to see an actual form with code in it to get my bearings. im just not sure what i should be seeing.

how to use primalforms CE radio buttons

Posted: Fri Sep 07, 2012 12:19 pm
by davidc
PrimalForms CE comes with a Getting Started Guide and a few samples. The blog has various PrimalForms article with samples that should help you get started.

I can't tell what the problem with the Radio Button is without seeing what you are doing. Are you trying to determine what radio button is checked? Or are the radio buttons not grouping and you can only check one in the entire form?

David

how to use primalforms CE radio buttons

Posted: Fri Sep 07, 2012 12:26 pm
by davidc
Looking at your script, it might be better for you to use combo boxes instead of radio buttons. It will make it easier for you to determine the selected value. You can use the combobox's SelectedItem property directly without having to translate the radio buttons to strings.

David

how to use primalforms CE radio buttons

Posted: Fri Sep 07, 2012 12:36 pm
by deviouz1
ok cool. ill give that a shot.

how to use primalforms CE radio buttons

Posted: Fri Sep 07, 2012 12:39 pm
by davidc
Spotlight on the Combobox Control:

http://www.sapien.com/blog/2011/06/21/p ... x-control/

David