Oracle Consulting Oracle Training Oracle Support Development
Home
Catalog
Oracle Books
SQL Server Books
IT Books
Job Interview Books
eBooks
Rampant Horse Books
911 Series
Pedagogue Books

Oracle Software
image
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
 Phone
 800-766-1884
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books
image
image

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle

STATSPACK Viewer

Privacy Policy

 

   
 

ss

Oracle Tips by Burleson 

Radio Buttons

Radio buttons are used to give the user a list of choices where they can only pick one value from the list.  Unlike a Select List, all the choices for the radio button are given on the page when rendered.  Because of this, it is a best practice to limit the number of choices to only a few.  An example of a Radio Button group is shown in Figure 10.29.

The user will only be allowed to select one of the colors which will then specify the value for the page item.

Radio button page items are based on a LOV.  In the LOV, the display values are specified and the value the page item will be set to when the radio button is selected.  The Color example above will be created in the following exercise.

To create a Select List in a region, click on the  icon in the Items region on the Page Definition page:

1.      On the Item Type page, select the type of list to create.  This case will just use the standard type Radiogroup and click Next.  Table 10.4 shows the different types of Radiogroups available.

RADIOGROUP

DESCRIPTION

Radiogroup

This is the standard type of radio group and just displays the text and provides a return value.

Radiogroup with Redirect

This type of radio group will not submit the page for processing, but it will redirect the page back to itself.  This can be used to set the session state for the item, but not submit.  It is commonly used when something else on the page may depend on the value for the radio group in a condition.

Radiogroup (with Submit)

This type of radio group will submit the page when an item in the radio group is selected.

Table 10.4:  The types of Radiogroups

2.       On the Display Position and Name page.

  •  Item Name: Enter the name of the item.

  • Sequence: Enter the sequence based on where the page item is to be displayed in the region.

  • Region: Select the region in which this page item should be displayed.

  • Click Next.

3.       This is the important page.  This is where the display values are defined and the result which will be set to the page item.  There are some options to fill in which are explained below.  For this example, the Display Null has been set to NO.  A simple static LOV will be used for this example.  The List of Values definition is:

STATIC:Red;R,White;W,Blue;B,Green;G,Purple;P,Yellow;Y 

If the values were saved in a table, a Select statement could be used to also populate the LOV.  The Select statement might look like:

select  color_name  display_value, color_code result
from  color_table
order by color_name;

  • Named LOV: Enter the name of the LOV that will provide the values for this select list.

  • Display Null Option: Choose whether or not to display the fact that the session state for the item is null.

Answering YES here will cause the select list to be rendered with an extra item indicating null.  The default text that will be displayed in the select list to indicate null is %.

  • Null Text: Enter the text to be displayed in the event the session state for the select list is null.  In Figure 10.24, the text Select a Department will be displayed in the select list when a value has not been selected from the list.

  • Null Value: Enter a value to be used in session state if no item is selected in the select list.  This item can be used in page validations to check if an item has been selected.  It is common to use a -1 for numeric data and an X for character data.

  • Click Next.

4.       On the Item Attributes page:

  • Label: Enter the text to display next to the select list.  Enter Colors.

  • Label Alignment: Choose the position to place the label.  Choose Above.

  • Field Width: This is not used for radio buttons.

  • Field Alignment: Select the position to display the Radio button in relation to the table cell in which it will be rendered.

  • Label Template: Choose the template to be used for the label.

  • Click Next.

5.       On the Source page:

  • Item Source: Choose the source for where the value is being set from.  It is normal to leave this set to Static Assignment where value equals source attribute.  What that means is when the page is rendered the selected item will be set to the value corresponding with the session state for the page item. 

  • Default: Enter the value that for the radio group. This value could be any of the values but make sure to use the result and not the display value. 

  • Click the Create Item button to not set any conditions, or click Next to set conditions.

6.       On the Cachingpage, select the desired Derive Item Source option.  The default is Only when the value is NULL.

7.       Click the Create Item button.

At this point, the radio group is not quite finished.  Running the page will show that the radio group displays in a single column shown in Figure 10.30, which is not quite the desired result.  The reason that it is in a single column is because the item creation wizard did not give the option necessary to have the values in a single line.  The item will have to be edited and a value changed. 

First, edit the page item, P3_COLORS, or whatever you named it.  A change needs to be made in the LOV definition for the COLUMNS field.  This field specifies in how many columns across the display values should appear.  In this case, the goal is to have a single line, so the value will be changed to six.  For two lines of values, three columns would be used. 

On display, the page item can be set to equal a value.  When the page is rendered, the display value corresponding to the item value will be shown as chosen.  For example, if P3_COLORS have the value of W, when the page is rendered, White will be chosen. 

Radio groups are great way to display a full list to the user and have them select only a single value.  Remember, to limit the choices to only a few because it may take up quite a bit of space on the page.


The above book excerpt is from:

Easy HTML-DB Oracle Application Express

Create Dynamic Web Pages with OAE

ISBN 0-9761573-1-4   

Michael Cunningham & Kent Crotty

http://www.rampant-books.com/book_2005_2_html_db.htm

 

Download your Oracle scripts now:

www.oracle-script.com

The definitive Oracle Script collection for every Oracle professional DBA

Linux Oracle commands syntax poster

ION Oracle tuning software

Oracle data dictionary reference poster



Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   

 

   

 Copyright © 1996 -2016 by Burleson. All rights reserved.


Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation. 
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks