Apex Item in interactive report not being displayed correctly - oracle

I'm creating a interactive report and I want to dynamically create apex items (text fields) in it, but they are not being displayed correctly.
This is my code:
select
APEX_ITEM.text( p_idx=> 1 , p_value=> null, p_item_id => 'dynamic_item') as "Textfield"
from dual
connect by level = 3;
This shows up in the report:
<input type="text" name="f01" size="20" maxlength="2000" value="" id="dynamic_item" />
But I would like to get the actual item and not the code?
What am I doing wrong?

It looks like you didn't set the escape special characters property to "No".
Go on your report and select the column you created (Textfield).
Then on the right at "Security - Escape special characters" select "No".
Now it should be displayed correctly!

Related

In Angular JS Kendo Drop down not setting the model value

HI I have following Kendo Dropdown, even though I have a value in ng-model, the dropdown is not selecting the default values.
<select name="myDropDown"
id="myDropDown"
class="width-90"
kendo-drop-down-list k-data-text-field="'key'"
k-data-value-field="'value'"
k-data-source="myDataSource"
ng-model="model.selectedProperty"></select>
model.selectedProperty does have the value . However the UI does't select the options.
DataSource Values:
[{"key":"Critical","value":0},{"key":"High","value":1},{"key":"Medium","value":2},{"key":"Low","value":3}]
model.selectedProperty = 1
The above one should have selected the second option, but the dropdown selects none
Well I have to make the selected value same object as in the list:
$scope.model.selectedProperty = {"key":"Critical","value":0}
And I updated the select tag to,
<select name="myDropDown"
id="myDropDown"
class="width-90"
ng-model="model.selectedProperty"
ng-options="option.key for option in myDataSource track by option.value">
</select>

making my tabular form dynamic

I have a checkbox on a tabular form. I need to be able to hide it if the submit date is not filled in and show it when a date is there. Once the checkbox has been clicked, I need to update another field based on the checkbox being clicked or when I hit the update button. is this possible on a Oracle Apex tabular form in version 4.2?
You can create dynamic actions on tabular form fields, but you need to know some Javascript / jQuery / DOM stuff as it can't be done declaratively as it can with page items.
As an example, I created a simple tabular form on the EMP table:
Using the browser's Inspect Element tool I can see that the HTML for the Ename field on row 3 looks like this:
<input type="text" name="f03" size="12" maxlength="2000" value="Ben Dev"
class="u-TF-item u-TF-item--text " id="f03_0003" autocomplete="off">
The relevant bits to note are the name "f03" and the ID "f03_0003". For all tabular form fields, the name indicates the column, and is the same for all fields in that column. The ID is made up of the name plus a string to represent the row - in this case "_0003" to represent row 3.
Similarly, the Hiredate fields are all named "f004" and have IDs like "f04_0003".
Armed with this information we can write a dynamic action. For example, let's say that whenever Ename is empty then Hiredate should be hidden, otherwise shown. In pseudo-code:
whenever an element with name "f03" is changed, the element with name "f04" on the same row should be hidden or shown.
So we can create a synamic action with a When condition like this:
Event = Change
Selection type = jQuery selector
jQuery selector = input[name="f03"]
i.e. whenever an input whose name is "f03" is changed, fire this action.
The action performed will have to be "Execute Javascript code", and the code could be:
// Get the ID of this item e.g. f03_0004
var this_id = $(this.triggeringElement).attr('id');
// Derive the ID of the corresponding Hiredate item e.g. f04_0004
var that_id = 'f04'+this_id.substr(3);
if ($(this.triggeringElement).val() == "") {
// Ename is empty so hide Hiredate
$('#'+that_id).closest('span').hide();
} else {
// Ename is not empty so show Hiredate
$('#'+that_id).closest('span').show();
}
Because Hiredate is a date picker, I needed to hide/show both the field itself and its date picker icon. I chose to do this by hiding/showing the span that contains them both. This code could have been written in many different ways.
You could apply similar techniques to achieve your aims, but as you can see it isn't trivially easy.

Selecting the prompt with Capybara

I have a select dropdown:
<%= f.select :image_size_id, options_for_select(#image_sizes.collect{ |i| [i.dimension, { id: i.dimension} ]}), { prompt: "Please select a Print Size" }, id: 'image_size_select' %>
Which returns this in HTML:
<select id="image_size_select" name="cart_item[image_size_id]">
<option value="">Please select a Print Size</option>
<option id="10x8" value="13">10x8 £14.0</option>
<option id="A4" value="14">A4 £33.0</option>
<option id="A3" value="15">A3 £36.0</option>
<option id="A2" value="16">A2 £47.0</option>
</select>
At the moment to select an option within my tests I can use for example:
find('#image_size_select').find("option[id='A2']").select_option
find('#image_size_select').find("option[value='14']").select_option
What I want to do though is select the prompt so that I can test my validation, can I set an id of the prompt or select by text ? I have tried:
find('#image_size_select').find("option[text='find('#image_size_select').find("option[id='A2']").select_option']").select_option
But that doesn't work, nor does:
find('#image_size_select').find(:xpath, 'option[1]').select_option
Capybaras #select chooses the option by the text, not value, of the option element. When passed with a :from option it is implemented as find(:select, '<select id, name, or associated label text (the :from option)>').find(:option, '<text of option element>').select_option which means the correct call to select the first option in the specified select is
page.select "Please select a Print Size", from: 'image_size_select'
to select the next option
page.select "10x8 £14.0", from: 'image_size_select'
Due to Capybaras default partial string matching
page.select "10x8", from: 'image_size_select'
would also select the 10x8 option as long as "10x8" is a partial match to only one of the options in the select
page.select "", from: 'image_size_select' should work. select allows you to select options from a select drop-down based on value (which in this case it's actually an empty string) and the select drop-down can be found in the page via name, id or label.
The documentation of the method is at http://www.rubydoc.info/github/jnicklas/capybara/Capybara%2FNode%2FActions%3Aselect

Select a value from a select List by value element

recently I came upon an issue while using page object that I could not find an answer to.
When using a select list to choose an option. I need to select by partial text or by attribute. here is an example:
<select id="custcol95" name="custcol95">
<option selected="" value="">- Select -</option>
<option value="5">Monthly Basic Plan - $27.99</option>
<option value="1">Monthly Business Plan - $54.99</option>
</select>
I tried:
select_list(:planPurchase, :id => 'custcol95')
I can do this:
selectCloudPlan_element.option(:value, CLOUD_PLANS['PersonalMonthly']).select
but that is deprecated.
I have yet to see a select by value option or by index anywhere on the web. Does one exist?
Also if there was a search by partial text that would fix my issue.
Thanks in advance.
The page object gem already supports selecting by partial text:
page.planPurchase = /Basic/
puts page.planPurchase
#=> "Monthly Basic Plan - $27.99"
Selecting by value is also supported by using select_value:
page.planPurchase_element.select_value('5')
puts page.planPurchase
#=> "Monthly Basic Plan - $27.99"
The page object gem supports selecting options by index using []. Note that you have to use .click as there is no .select. The index is 0-based.
page.planPurchase_element[2].click
puts page.planPurchase
#=> "Monthly Business Plan - $54.99"

how to select dropdown on value option in ruby watir?

This is my drop down and i want to select it on its value option
<select id ="">
<option value="01" title=" 01 - Live animals"> 01 - Live animals</option>
</select>
I know that how to select drop down on its content i.e.
ie.select_list(:id, "DropDownList_Product").select("01 - Live animals")
actually I want to select drop down on its value 01,what should i have to do for that ?
Something like this should work:
ie.select_list(:id, "DropDownList_Product").select_value("01")
More information at http://rdoc.info/gems/watir-webdriver/Watir/Select#select_value-instance_method

Resources