Apex: Validation on two dependent page items

Apex 4.2
I have a  form with two separate regions that each have text fields / select list on them. I need to validate one field againt another.
**Region 1
- P10_REQUESTOR
- Select List
- LOV defenition:
SELECT first_name
FROM PERSONS
ORDER BY firs_name
I.e. you can select a first name from the select list
**Region 2
- P11_NAME
- Text Field
A regular text field to  type in the first name of a person
**Logic:
When a user navigates to this page, they can either pick a first name from the select list OR if the name is not in the list, they can type in the name in the P11_NAME text field. However, they can not do both. I am having a little trouble writing a validation script to capture these cases.
Case 1: P10_REQUESTOR is null & P11_NAME is not null
Case 2: P10_REQUESTOR is not null & P11_NAME is null
If both items are null then an error message needs to appear stating that one or the other must be filled out
If both items are not null then an error message needs to appear stating that you can only fill out one or the other
I have pseudo coded it and understand the logic but am having trouble on knowing which options to choose when creating the validation. I was thinking its somewhere along the lines of a PL/SQL function with a few IF statments in it.
Any help would be greatly appreciated. Thanks in advance.

Hi NewApexCoder,
your problem is solved in two ways,if i understand you correctly.
You can do a simple javascript on the  NAME i.e you can enable and disable this item_type by putting this snippet into the  Form element attributes
To take care of Case1
OnBlur = "javascript: if (this.value != '') { document.getElementById('P11_NAME').value = 0; document.getElementById( ' P11_NAME').disabled = true; } else {document.getElementById ( 'P11_NAME').disabled = false;}"
OR
2.  In the  Select List Page Item ,By adding an extra  Display Extra Values = YES
                                   Display Null Value  = YES
Null Display Value = '%'    Null Return Value = -1
After which you can set up a validation for an item.
Validations> Page>P10_REQUESTOR>  Then choosing a PLSQL Function Returning Boolean
Validation Code
begin
if P10_REQUESTOR = -1 then
return true;
else
return false;
end;
2.Error Message
"A Request must be selected"
To take care of case 2
Thanks
Benjamin.
www.bkintsiful.blogspot.com

Similar Messages

  • How to create validations on exit a page item?

    Hi all,
    I need to validate a field on exit it and not when click a button. Is it possible in apex? 
    Thanks
    bsalvador

    bsalvador
    You didn't state the apex version you are using but assuming your at least on version 4 all client side interaction start with Dynamic actions.
    These are explained in chapter 17.9 of the Application Express Application Builder User's Guide Release 4.2.
    See if using the when condition works for the validations. With an alert as action to notice the user of the error.
    The standard when conditions would probably not cover all your needs completely.
    Then JavaScript comes into play. Some starting points
    For basic javascript
    Code academy
    Mozilla developer network Getting started tutorial
    Specific for APEX documentation for the javaScript API
    And since APEX uses jQuery the jQuery learning centre.
    An other approach when you're on APEX 4.1+ have a look at the following plugin Live Validation
    This plugin supports a number of validation types with out the need of any programming. Check out the list of supported validation types here.
    Nicolette

  • Manually comparing Page items from two versions of an application?

    Hi folks,
    I have two separate applications, one being an older version of the other. Is there a way to query the APEX metadata on a per page item basis to check for any small changes between items, or which items exist on one but not the other?

    Thank you so much, it's very close to what I need, and at least something I can work with... one question though, how exactly do the details work? I'm seeing things like:
    P21_GIA_CUSTOMER da=HIDDEN_PROTECTEDV,seq=00930,r=CONTACT INFORMATION,c=Always,d=STATIC_TEXT_WITH_SUBSTITUTIONS,l=GIA Customer12,m=t=Optional Labels=CUST_ID7DBColumn ro=,lov=1NoNo,t=No,s=3020005,a=nowrap6,b=,disp=YesYes11 l=RightLeft,c=PerSesUnrest
    I'm not sure how to interpret that to see the differences.

  • Pass json result of rest webservice into page items

    Hello,
    I have created a webservice reference, and a from with report on that webservice. I fill in a zipcode and click submit and the results will put in a collection.
    The response is a json object and is stored in the CLOB001 column of the collection. Example. : {"success":true,"resource":{"street":"Amsterdamseweg","postcode":"1181BP","town":"Amstelveen","municipality":"Amstelveen","province":"Noord-Holland","latitude":52.3163363636,"longitude":4.856420303}}.
    But I want that if you fill in a zipcode that only the values of street and town from the json object will passed in two seperated page items. What is the best way to achieve this?

    Hi
    See this thread
    /message/2187817#2187817 [original link is broken]
    Kind Regards
    Mukesh

  • Page item validation

    I created a page in APEX Express 4.2.3.00.08.  On the page there are two items: a text field named P55_KEY_ID and an LOV named P55_REASON with the values LOST, BROKEN, OTHER.  I created a dynamic action that enables P55_REASON when P55_KEY_ID changes. Our business rule is if P55_KEY_ID has been changed then P55_REASON must have a value, i.e. not null.  Can I define a validation on P55_REASON  with a condition to test the disabled property of the page item with javascript, if it is disabled then return false otherwise true.  Where would I place the following javascript?
    IF $x(‘P55_REASON’).disabled then
      Return  false;
    Else
    Return true;
    End if;

    What is the validation? What version are you in?
    There are some item validations that execute automatically based on settings like 'Required'.
    Date pickers has other attributes that can declaratively validate range.

  • Page item rendering location relative to report?  (APEX 2.2.0)

    Hi all,
    What controls where the page items in a region containing a report will be rendered? I have two regions that (I thought) I set up identically, but one has the items above the report and the other below.
    The only difference between them is that the one with the items above is on a non-zero page, whereas the one with the items below is on page zero.
    (I cannot post my app to a public area as an example.)
    Am I missing something?
    Thanks!
    Don

    Hi all,
    I apologize if I was vague or confusing. It's been a long Friday and it is continuing to be a long Friday = ) Louis-Guillaume, I tried changing one of the regions, and something very odd happened! So here's exactly what I do:
    I create a region in page 0, "My Page Zero Region". It is an SQL report region. I then add "Item One" and "Item Two" to that region. The items are in the same region as the report table. I put it at the "Page Template Body (3)" display point. I then get this:
    My Page Zero Region
    Item One : [             ] (this is an item.)
    Item Two : [             ] (this is an item.)
    |            |  the table |         |
    |            |            |         |
    |            |            |         |
    ---------------------------------The items are displayed above the table. I then switch the display point to "Page Template Body (2)". The region is then rendered differently.
    My Page Zero Region
    |            |  the table |         |
    |            |            |         |
    |            |            |         |
    Item One : [             ] (this is an item.)
    Item Two : [             ] (this is an item.)It seems that APEX treats the entire region differently depending on which display point it is in. Is that the correct functionality, or should I investigate further?

  • Button condition on page item and Validation error Conflict

    Hi,
    I have a select list page item and a button on page whose condition is based on the select list page item value(eg, If (:P2_item1='val1'){return true;}) with condition type=PL/SQL function returning boolean. This buttons submits the page.
    It' coming fine in normal case. However, if I select some value val2 from the list and then click the button, and if there are any validation errors (like mandatory check or email check fail etc), then the button disappears because it evaluates the button condition based on the changed value(val2), but the page has not yet been submitted because of validation errors.
    I think this can be solved if I create the button condition based upon database column value instead of page item as db col value won't change until the page is submitted.
    This look like very basic use-case and I would like to know if there is any better solution to this problem.
    Note: I am using Apex 4.2.1

    I don't want to show/hide the button on the change of the page item lov value, so i am not using Dynamic action.
    What i was is to make button visible based on a condition(which is based on page item), for which we have condition attribute of a button available.
    This is a very common thing where a user chooses the button condition as Value of item/column in expression 1 is null/expr2. But what if the user changes the page item value but it doesn't get submit due to validation error. In that case, the button condition fails.
    So, i guess i have to use column name in expression 1, can u tell how to do that?
    Expression 1 = IF (:P2_STATUS='val1') then return true;
    How to change the above to use db column 'status' instead? Any direct way(like #Status#) or I have to query db to get it using select.
    Any alternative approach?

  • Reset data picker page item by selection page item in Apex

    Hi,
    Need to create a report based on date ranges and for this created a interactive report and two page item datepicker fields P15_fromdate and p15_todate. Report works fine with this criteria.But user wants one more field quarter(P15_quarter), When they select the quarter the range values has to get reset and as to get applied to report.
    Issue here is unable to find a way to set the page range item values based on the quarter field selection
    Need help how to reset the page item fields.
    Thanks in advance.
    Thanks,
    Sandeep

    Ligon,
    You're right to think this is pretty laborious stuff. A co-worker wanted to do the same, to make sure users didn't lose a change when clicking Cancel. I suggested he look at calculating the query checksum before and after, which he tried. But it got very cumbersome very fast and he ended up dropping the idea. He's fairly new with Apex, but he's also a quick study, so it's not like he's a novice coder.
    I don't have his implementation details anymore to even share with you.
    Sorry I couldn't be more help.
    Good luck,
    Stew

  • Apexlib page item validation not shown correctly

    Good morning guys! I have a question concerning the Apexlib page item validations.
    Basically I just want to validate page item values and have errors displayed in a notification region on the very same page on submit.
    I set up the Apexlib, which works perfectly for reports. However, when it comes to the page item validations, I am always rerouted to the Oracle Error page.
    Do you know why or have you experienced similar problems?
    Here is a part of the debug code when the error page is initialized.
    Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.03: ...Process "ApplyMRU": MULTI_ROW_UPDATE (ON_SUBMIT_BEFORE_COMPUTATION) #OWNER#:VT_TBL_TOTHOLZ:CNT_TOTHOLZ
    0.04: Branch point: BEFORE_COMPUTATION
    0.04: Computation point: AFTER_SUBMIT
    0.04: Tabs: Perform Branching for Tab Requests
    0.04: Branch point: BEFORE_VALIDATION
    0.04: Perform validations:
    0.04: Branch point: BEFORE_PROCESSING
    0.04: Processing point: AFTER_SUBMIT
    0.04: ...Process "ApexLib-Before Computation/Validation": PLSQL (AFTER_SUBMIT) BEGIN ApexLib_Lov.clearLovNullValues; ApexLib_Item.validateItems; ApexLib_TabForm.validateColumns; -- ApexLib_Error.showErrorStack; END;
    0.06: Show ERROR page...
    If you have an idea please be so kind as to let me know!
    Many thanks,
    Seb

    Hi Peter!
    Thanks for having a look!
    I am using Apex 3.2 and Apexlib 1.6!
    Like I said, the report validations are functioning properly! It's just the error message is not displayed on the same page in a notification field. Instead the user is redirected to the original Apex Error Page when the error is caught.
    What validation do I want to carry out?
    I tried to verify the input of a text box with $APEXLIB_MAX_VALUE=10$.
    I thought it might be a minor problem, which I couldn't find. Already checked the installation of Apexlib twice. Seems to be alright.
    Best regards,
    Seb
    PS: Have a splendid WE

  • Validating page item  to be less than 50 charachters

    Hello,
    I have created validation for page item, its string and I want it to be not more than 50 letters,
    I used PL/SQL expression and I used this one
    V('P55_MANAGER_NAME').length > 50
    I got this error
    ORA-06550: line 1, column 47: PLS-00487: Invalid reference to variable 'NEW <expression>' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    Can some one help me in having the right expression??

    TomTom101 wrote:
    Hello,
    I have created validation for page item, its string and I want it to be not more than 50 letters,
    I used PL/SQL expression and I used this one
    V('P55_MANAGER_NAME').length > 50
    I got this error
    ORA-06550: line 1, column 47: PLS-00487: Invalid reference to variable 'NEW <expression>' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    Can some one help me in having the right expression??Well to start with the basic logic is incorrect.
    length > 50means "must be longer than 50 characters".
    Secondly
    V('P55_MANAGER_NAME').length > 50is a mixture of PL/SQL and JavaScript syntax. From the error message it appears you're doing this in an APEX Post-Submit Validation?
    In which case the syntax is
    length(:p55_manager_name) <= 50

  • Need help on Oracle APEX- Retaining Page items of one Session in another

    Hi,
    I am creating an apex application in which there exist two pages. Out of 2 pages, I need to provide authentication on one page and no authentication on the other one.
    When I access the first page by public, I must pass some page items to the second page. Since, I have aunthentication on page 2, there will be a new session created and I could not retain the page items that are passed from Page 1 to Page2.
    Please help me in retaining the page item values of Page1 in Page2.
    Thanks for your help.

    Hi Andy,
    I have passed the values from page 2 to page 3. Due to Authentication on Page 3, the passed values are cleared and a new session created.
    Is there a way to retain the item values using Application items or Application computations?
    Please help.
    Thanks,
    Hanu.

  • Capture External HTTP POST Into APEX Page Item

    We have an APEX page that needs to capture into page items two form fields posted from an external application: PARAM1 and PARAM2.
    Unfortunately the external application cannot be changed and we tried to add the two posted fields as APEX page items with the same name, yet we get back an exception:
    f: SIGNATURE (parameter names) MISMATCH
    VARIABLES IN FORM NOT IN PROCEDURE: PARAM1,PARAM2
    NON-DEFAULT VARIABLES IN PROCEDURE NOT IN FORM:
    Any ideas on how this can be done?
    Thank you.

    You could do this with an intermediate non Apex page (.html for example) that receives the params and the calls apex.
    Or even better with a procedure that gets called by the external post:
    procedure myForm (param1 in varchar2, param2 in varchar2)
    is
    begin
      f(p=>'app:1:0::::P1_PARAM1,P1_PARAM2:' || param1 || ',' || param2);
    end;
    Then you grant execute on myForm to apex_public_user
    change app to your app number or alias and use the right page or item name. But you'll want the parameters to match the names posted.
    hope this helps
    The new myForm procedure can be called with the same path as the f procedure in APEX.  So if you're APEX URL is something like:
    https://apex.oracle.com/pls/apex/f?p=...
    Then you can use:
    https://apex.oracle.com/pls/apex/myForm
    And with parameters:
    https://apex.oracle.com/pls/apex/myForm?param1=value1&param2=value2
    Thanks
    Jorge
    Message was edited by: jrimblas

  • Page items not getting set upon login in APEX 4.0.2

    We just upgraded our APEX in development from 4.0.1 to 4.0.2.00.07. While testing found that in APEX developer, unless we press one of the buttons (Debug/View Debus/Show Edit Links) in the tool bar on the login page, the application/page items are not getting set to display the conditional items (page regions/buttons/Tabs etc,.) Could this be some setting within APEX Developer?
    But the display is fine when the application is run directly in a browser, as an end user.
    Is anybody else having this issue? We are holding off our production upgrade because of this issue.
    Any help is appreciated.
    Thanks
    Radhika

    Hi,
    Could you please explain what you mean by
    Running 4.0.2 version...need to know how to remove the pop-up login and go straight to welcome/splash page?Do you mean application builder or your application login page ?
    If you mean application builder, you can not remove login page. You need always login to builder.
    If you mean your own application then change authentication scheme
    http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/sec.htm#sthref2297
    Regards,
    Jari

  • Page item validation does not get removed

    Hi All,
         I had a page item validation defined on the page and later removed by deleting the validation in the 'page processing' in Application Builder. However, the validation still seems to execute at runtime. Can anyone tell me if it needs to be deleted from some other place as well.
    Thanks

    What is the validation? What version are you in?
    There are some item validations that execute automatically based on settings like 'Required'.
    Date pickers has other attributes that can declaratively validate range.

  • How do you populate a page item in apex with a value read from excel

    Dear All
    I am working on application where I am uploading a csv file in oracle apex. I then need to access a value in Cell B2 of the csv file and populate a page item called
    :P2100_AUTHORISATION_ID with this value. Many of the examples I have found upload the data using v_data-array into a table but I don't need to do that I just need to get the value from the csv file and then display additional information about the file allowing the user to either or continue or cancel the request to upload. I am running into a small problem that I can't explain and wondered if anyone had any ideas.
    Here is the code I am using to try and populate and item called :P2100_AUTHORISATION_ID but when I poulate the item the value is always 0. But if I replace the line :P2100_AUTHORISATION_ID:= v_data_array(2) with a raise_application_error(-20001,v_data_array(2)); The correct value is displayed in the eror. Any Help would be appreciate and I apologise in advance if this akes no sense at all:-)
    declare
    --variables needed to read excel data from flow files
    v_blob_data BLOB;
    v_blob_len NUMBER;
    v_position NUMBER;
    v_raw_chunk RAW(10000);
    v_char CHAR(1);
    c_chunk_len number := 1;
    v_line VARCHAR2 (32767) := NULL;
    v_data_array wwv_flow_global.vc_arr2;
    v_rows number;
    v_sr_no number := 1;
    begin
    --------------------------------------get file info from www_flow_files
    select blob_content into v_blob_data from wwv_flow_files
    where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER) and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
    v_blob_len := dbms_lob.getlength(v_blob_data);
    v_position := 1;
    --Read and convert binary to char
    WHILE ( v_position <= v_blob_len ) LOOP
    v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
    v_char := chr(p_bl_wd_data_entry.hex_to_decimal(rawtohex(v_raw_chunk)));
    v_line := v_line || v_char;
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved
    IF v_char = CHR(10) THEN
    -- Convert comma to : to use wwv_flow_utilities </span>
    v_line := REPLACE (v_line, ',', ':');
    -- Convert each column separated by : into array of data </span>
    v_data_array := wwv_flow_utilities.string_to_table (v_line);
    --get filename from wwv_flow_files
    select filename into :P2100_FILE_NAME from wwv_flow_files where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER) and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
    :P2100_AUTHORISATION_ID:= v_data_array(2);
    -- Clear out
    -- v_line := NULL;
    --v_sr_no := v_sr_no + 1;
    END IF;
    END LOOP;
    end;
    Best Regards
    Lynn

    Hi Joel
    Continuing on from my last question, there was something else I want to ask if you dont mind.
    Now that I have the v_data_array(2) value in a page item I would like to use as an input value to a procedure to return some information I need displayed on the page. To do this I need to convert it to a number but when I try to so this I get the following error
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    When I use the wwv_flow.debug that you told me about it is outputting a value '4851 ' so it look like there may be some sort of asii character causing a problem. I have tried using trim(v_data_array(2)) and ascii(v_data_array(2)) but nothing seems to work.
    Would you know how to convert a v_data_array value to a number? At the moment I am attemting to do it withiin the same code I attached in my earlier post but I have replaced the assignment of :P2100_AUTHORISATION_ID with the code below where P_BL_WD_DATA_ENTRY.getauthid is the procedure returning the values I need.
    :P2100_AUTHORISATION_ID:= P_BL_WD_DATA_ENTRY.getauthid(to_number(v_data_array(2)));
    Thanks
    Lynn

Maybe you are looking for

  • New Condition type for pricing

    Hi, I have a requirement wherein I want to create new condition type for add on cost of material with manaual entry . this condition is to be given in inforecord. How to proceed? also, this contion type to be inserted in pricing schema??

  • Frm-92101 happens when I open a form from another form and close it.

    Frm-92101 happens when I open a form from another form, check something, show a message to the user and exit the form to the previous form. Forms version: 10.1.2.0.2. Java: 1.6.0_23. Browser: IE6 When I put before the "EXIT_FORM" two messages, everyt

  • How to get the Version of the Solution Manager

    Hi Experts, The Solution Manager is Already Insatlled on our Machine. How to Find out the Version of the Solution Manager??? How to Disply the Solution Manager Key???? Please give me the Proper Solution on this. Regards Khanna

  • What is the "Live" page and need help in data merge

    Hello, Im very new to indesign so bare with me. Im trying to data merge (Need to create a merge template?) and from what I understand is that I need it to be on the "Live" page. Someone on the forum suggested this..... There are two ways to set up th

  • HT4437 Viewing a downloaded video on Apple TV

    I've downloaded a video to my iPad using the VDownloads app. How do I play this on my Apple TV?