how to use primalforms CE radio buttons

This forum can be browsed by the general public. Posting is no longer allowed as the product has been discontinued.
User avatar
deviouz1
Posts: 30
Joined: Fri Jul 13, 2012 6:04 am

how to use primalforms CE radio buttons

Post 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.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

how to use primalforms CE radio buttons

Post 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
David
SAPIEN Technologies, Inc.

User avatar
deviouz1
Posts: 30
Joined: Fri Jul 13, 2012 6:04 am

how to use primalforms CE radio buttons

Post 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

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

how to use primalforms CE radio buttons

Post 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
David
SAPIEN Technologies, Inc.

User avatar
deviouz1
Posts: 30
Joined: Fri Jul 13, 2012 6:04 am

how to use primalforms CE radio buttons

Post 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.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

how to use primalforms CE radio buttons

Post 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
David
SAPIEN Technologies, Inc.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

how to use primalforms CE radio buttons

Post 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
David
SAPIEN Technologies, Inc.

User avatar
deviouz1
Posts: 30
Joined: Fri Jul 13, 2012 6:04 am

how to use primalforms CE radio buttons

Post by deviouz1 »

ok cool. ill give that a shot.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

how to use primalforms CE radio buttons

Post by davidc »

Spotlight on the Combobox Control:

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

David
David
SAPIEN Technologies, Inc.