How to make select list and input text field read only for preventing editing - oracle

I am developing an oracle APEX application.
I created the form with master details form. How to make select list and input field to read only on tabular form (Add Row Section) when the status value is selected "Closed" or "Cancelled".
I have searched on stackoverflow but I could not find any related question about that.
Please give me idea about that ? Thank you..

Add a classic report to the page with the same columns. Render the tabular form when the status is not close or cancelled, and render the classic report when it is by using the condition on both regions.

Probably half a dozen ways to do this.
Add column in your sql (that isn't displayed to user) that calculates literal value of 'readonly' or null, depending on your status column value. Give it a column alias of 'readonly'
CASE status IN ('Closed','Cancelled') THEN 'readonly' END AS readonly_col
Edit your Status column and add to 'Element CSS Classes' : #READONLY_COL#
(hash tag surrounding your column alias)

For LOV/Select List, here is a simple solution for you
// disable:
$('#P123_ITEM_CNT').attr('readonly', true);
$('#P123_ITEM_CNT').css('pointer-events','none');
$('#P123_ITEM_CNT').css('opacity','.5');
$('#P123_ITEM_CNT').off('keydown');
//enable:
$('#P123_ITEM_CNT').attr('readonly', false);
$('#P123_ITEM_CNT').css('pointer-events','');
$('#P123_ITEM_CNT').css('opacity','inherit');
$("#P123_ITEM_CNT").on('keydown');

Related

how to multiply two fields in a form in oracle APEX

everyone. I am making accounting program in oracle APEX. I need to multiply two fields in a form and to save the result in a third field. I searched for that in youtube and here in stackoverflow but did not find anything aprropriate. Can you help me?
Dynamic action is a simple option; create it on both items (so that it fires when any item's contents has changed). What will it do? Set value of the resulting item.
Action: set value
set type: PL/SQL expression
expression: :P1_VAL1 * :P1_VAL2
items to submit: P1_VAL1, P1_VAL2
affected element: item, P1_RESULT
That's all.

Why is free-jqgrid not resetting row ids after GridUnload?

The Problem
I have a very complex, rather outdated jqgrid implementation that I'm upgrading to the latest free-jqgrid and we're having an issue in that after clearing the grid with unload, when we re-initialize the grid, the row ids are higher than they should be to start.
They seem to still be incrementing and not starting again. Are there some global counters I need to clear out to have the grid completely clear itself before we re-render it?
Grid Clear
if ( this.timesheet_grid ) {
this.timesheet_grid.grid.jqGrid( 'GridUnload' );
this.timesheet_grid.grid = null;
this.timesheet_grid = null;
Rows after GridUnload has been run
Shows an id like jqg56
Stuff I've Tried Since Posting
GridDestroy
clearGridBeforeUnload
SOLUTION
As #Oleg has suggested i simply needed to set the id attribute manually when processing the grid data.
I see that your incorrectly understand the meaning of rowids and the requirements for input data. I'm wonder especially about the suggestion of Tony to reset $.jgrid.guid. I find the suggestion very bad because it looks like a solution, but it can produce more seriously problems as the problems, which are solved!
First of all, it's important to understand what is rowid. Rowid is the values of id attribute of the grid rows: the id values of <tr> elements of the grid's body (see here). The rowid are used as a parameter of almost all callbacks and events of jqGrid. Because of that jqGrid must assign id attribute to every row and the input data of the grid have to contain rowid information! The existence of rowids is critical for working jqGrid. Only because of that jqGrid generates unique rowids in case of wrong input data. Alternative for generation of ids would be preventing creating the grid at all.
jqGrid tolerates the error with specifying the rowids in input data only for some simple grids, where one need just display some simple data and one never need to use rowids. If you use ids then you should fix the problem only in one way: you have to fix your input data. You can for example include id property with unique value in every element of input data. You should take in consideration that no id duplicates exist not only in the grid but on the whole HTML page. It's strictly recommended to use idPrefix option with unique value for every grid always if your HTML page have more as one grids (inclusive grid with subgrids).
Resetting of $.jgrid.guid is very dangerous and it can break functionality of jqGrid because of creating elements with duplicate id values. The property $.jgrid.guid is global. It's common over all grids and subgrids on the page. Simple subgrids scenario will produces id duplicates after you manually reset $.jgrid.guid. It will be used inside of $.jgrid.randId() method used in many places of jqGrid code. For example, the method addRow used by inlineNav uses the method.
I repeat my suggestion more clear once more. If you uses rowids or if the values of rowids are important for you in some way then you have to include id property to every item of input data. If some other property has already an unique value then you can add key: true in the corresponding column of colModel (one can use key: true in only one column). Alternatively, you can add prmNames: { id: "myId" } if myId property of input data contains unique rowid instead of default id property.
jqGrid uses common counter in order to be a sure that there will be no duplicate values when a build in id generator is used.
To reset the value you will need to set the guid parameter to 1 - i.e
$.jgrid.guid =1;
after you unload the grid
If the solution is based on the knowing the behavior of the product, then this is a good solution.
If we try to solve the problem, without to knowing the behavior - it is a dangerous solution.
It is very easy to say - this is bad solution and it is very very dangerous to use this solution - so my question is:
What is happen with the counter if the user reload the page under some conditions?
The answer is: the counter is reset and we go to the same situations which are described in the above answer.

How do you show all rows with missing fields in Crystal Reports?

I'm struggling with Crystal Reports suppressing rows whenever I add a field that some rows may not have data in.
I've been able to fix some of the rows and make them show by using the formula:
if not isnull({field}) then {field} else "Arbitrary string to make row display"
This at least fills in the absent field with something and displays the row.
Do I really have to try and identify every field that may have incomplete data for some rows? Or is there some global method to make all rows show no matter what?
Something like: If isnull(ANYTHING) then " "?
you can do right click on the field, then under suppress, click the formula icon beside it and you can input there the conditions.
You can try the following in report options:
Convert Database NULL values to Default
Convert Other NULL values to Default.
This is hidden in File > Report Options. I have used Convert Database NULL Values to default to show 0's instead of blanks for null valued summaries

Passing more than 3 items in a reports column link

I have a report that is listing students and I want a column to edit a student. I've done so by following this answer:
How do you add an edit button to each row in a report in Oracle APEX?
However, I can only seem to pass 3 items and there's no option to add more. I took a screenshot to explain more:
I need to pass 8 values, how can I do that?
Thanks!
Normally, for this you would only pass the Primary Key columns (here looks like #RECORD_NUMBER# only). The page that you send the person to would then load the form based on the primary key lookup only. If multiple users were using this application, you would want the edit form to always retrieve the current values of the database, not what happened to be on the screen when a particular person ran a certain report.
Change the Target type to URL.
Apex will format what to already have into a URL text field which magically appears between Tem3 and Page Checksum.
All you need to do is to add your new items and values in the appropriate places in the URL.
I found a workaround, at least it was useful to my scenario.
I have an IR page, query returns 4 columns, lets say: ID, DESCRIPTION, SOME_NUMBER,SOME_NUMBER2.
ID NUMBER(9), DESCRIPTION VARCHAR2(30), SOME_NUMBER NUMBER(1), SOME_NUMBER2 NUMBER(3).
What I did was, to setup items this way:
P11_ITEM1-->#ID#
P11_ITEM2-->#DESCRIPTION#
P11_ITEM3-->#SOME_NUMBER##SOME_NUMBER2#
Previous data have been sent to page 11.
In page 11, all items are display only items.
And P11_ITEM3 actually received two concatenated values.
For example, the calling page has columns SOME_NUMER=4 and SOME_NUMBER2=150
so, in pag1 11, P11_ITEM3 shows 4150
In page 11 I created a Before Footer process (pl/sql expression)
to set up new items, for example P11_N1 as source SUBSTR(P11_ITEM3,1,1)
and item P11_N2 as source SUBSTR(P11_ITEM3,2,3)
So, I had those items with corresponding values from the calling IR page.
The reason I did not pass the primary key only for new lookup access, is because i do not want to stress database performing new queries since all data are already loaded into page items. I've been an oracle DBA for twenty years and I know there is no need to re execute queries if you already have the information somewhere else.
These workarounds are not very useful for a product that bills itself as a RAD tool.
Just include a single quoted word in the select statement (Select col1, 'Randomword', col2 from table 1;)
Then define that column as a link and bingo! More items than 3 to select.

How to find and delete a specific record in table/grid using Selenium

Assume that, a page contains a table of records (created dynamically) with Delete, Edit and View options (for each row/record). Now i want to find a specific record with name/id and delete that record. Is this possible in Selenium?
Help me to resolve this! Thanks in Advance.
Sure, we do this all the time in our tests. You need to write an element locator that finds the row you want and identifies the appropriate button, then just Selenium.Click(...) on it. The exact locator value will depend on your application, but it will probably be something like xpath=//path/to/table/tr[td[pos() = 1 AND text() = 'My Name']]/td/button[#value='Delete']. In other words, "the button with the value 'Delete' in the row that has 'My Name' in its first cell in the table".

Resources