Tabular Form Validation Help

Version 2.0
I have a Tabular Form that represents Show dates. There are three displayed fields: Description (Text Field), Date (Date Picker), and Active (Static Select List: Yes;1,No,0).
I need help to create a page validation to make sure that only one show is ACTIVE at a time when the row is submitted.
Thanks,
Joe

On the database side, I use the following technique to implement a "radiobutton" constraint. I think I picked it up from AskTom.
If you have a table like
create table t
  show_id int,
  show_date varchar2(50),
  active_flag varchar2(1),
  constraint t#pk primary key (show_id,show_date)
);which is what I think your data model looks like.
You want to ensure that for a given show, only 1 show_date is active (radiobutton-style).
Create the following function-based index on the table
create unique index i on t(decode(active_flag,'Y',show_id));This will prevent invalid data from getting into the table, no matter what.
Regarding your Apex issue, I would suggest that when you add a row to the tabular form, default the select list to Inactive. You can use client-side Javascript to do some toggling of the select lists, but that really assumes that all the rows are being shown in the tabular form. In any case, the unique index above would guarantee data integrity when the data finally hits the database.
Hope this helps.

Similar Messages

  • Tabular Form Validation not working in tabular form APEX 4.0

    Hi,
    I am using APEX 4.0. I have a tabular form with Tabular form validation done with it.
    Item not null is the validation.. so if I dont type any value in the any of the fields in the tabular form and press the Submit button, the first time error is shown... but when I click the Submit button again, with still the empty rows the page is submitted.
    How to resolve this issue?
    Edited by: Suzi on Oct 5, 2010 11:13 AM

    Look at this thread - Re: Validations of tabular forms in 4.0

  • Tabular Form Validation - Save Correct Values

    I'm using Denes' example of tabular form validation. It finds the errors and displays the error messages, but I lose any values that were entered correctly. Do I need to use a collection to save them? I've been looking through older posts and one comment was that you'd only need a collection if you wanted to show the user the values they entered incorrectly. With Denes' logic it tells them what line had the error and what the original value was.
    DECLARE
      l_error   VARCHAR2 (4000);
    BEGIN
       FOR i IN 1 .. apex_application.g_f02.COUNT
       LOOP
          IF NOT TO_DATE (apex_application.g_f05 (i), 'YYYY')
                BETWEEN   TRUNC (TO_DATE (apex_application.g_f04 (i),'YYYY'))
                     AND  TO_DATE ('2008','YYYY')     THEN
                      l_error :=   l_error
                        || '</br>'
                        || 'Row '
                        || i
                        || ': Photo Inspection Year has to be greater than Date On Map and less than 2008 for '
                        || ' Map: '
                        || apex_application.g_f02 (i)
                        || '<br> Requested date: '
                        || apex_application.g_f05 (i);
          END IF;
          IF NOT TO_DATE (apex_application.g_f04 (i), 'YYYY')
                BETWEEN   TO_DATE ('1890','YYYY')
                     AND  TO_DATE ('2008','YYYY')     THEN
                      l_error :=   l_error
                        || '</br>'
                        || 'Row '
                        || i
                        || ': Date on map has to be between 1890 and 2008 for '
                        || ' Map: '
                        || apex_application.g_f02 (i)
                        || ' <br>Requested date: '
                        || apex_application.g_f04 (i);
          END IF;
       END LOOP;
       RETURN LTRIM (l_error, '</br>');Thanks,
    Susan

    It doesn't make sense to post your questions within a closed thread - start you own thread.
    It is possible to do that but you would need to save your data into a collection to keep the changes and display the error message on the same page.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Tabular form validation to restrict user

    Dear all,
    I want to apply the validation on tabular form for my inventory module and I want to restrict the user  that the received quantity of particular item should not be greater than  the P.O quantity
    For example
    In  P.O
    Item Qty
    A 20
    Received Quantity
    Item Qty
    A 21
    Or if items are received in two shipments like as following
    Item Qty
    A 10
    A 11
    I want to put the validation to restrict the user that he can’t save the item quantity more then ordered quantity weather is received partialy or all at once, but I do not understand how can i do that.
    I m using Apex 4 with Oracle 11G R2 on windows Server 2003.
    Please help
    Thanks
    Suhaib
    Edited by: suhaib ahmed on Jun 18, 2011 1:39 PM
    Edited by: suhaib ahmed on Jun 19, 2011 12:53 PM

    hi,
    Refer Denes Kubicek - Apex Solution:
    http://apex.oracle.com/pls/otn/f?p=31517:41:7446375838232779:::RP,::
    http://apex.oracle.com/pls/otn/f?p=31517:214:7446375838232779:::RP,::
    Thanks,
    Kartik Patel
    http://patelkartik.blogspot.com

  • Cascading select list in a tabular form -plz help me out

    hello,
    how can i implement cascading select list for filtering my tabular form report results.
    Like i want to have the cascading select list's above the tabualr form report such that when i select the value in one select list, this should populate the values in other select list box(like one select list is dependent on other select list) and try to click a button say refresh, my tabular form report should be refreshed and should filter the report based on the select list value.
    i want to have three select list items above my report - and these select list are dependent on one other - tats why i want to make them cascading select list.
    can anyone provide me with an example of the cascading select list.
    can anyone help me out with cascading select list.
    thanks.

    Aplication item is always hidden - Shared Components > Application Items. You can create only one item and that would also be enough. For transparency purposes I said to create two. However, one will do the job.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Tabular Form Validation: Comparing Two Columns vs Check Constraint

    What is the best approach for validating that one column needs to be greater than another column in a tabular form when attempting to save. (E.g. An effective date and expirey date column. The expirey date column >= effective date column)
    At the moment I have a check constraint on the two columns at the database level which is fine but it returns and passes up a pretty cryptic (from a business user perspective) unfriendly message to the user as follows:
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-02290: check constraint (IDMTC.ADDRESS_TYPE_CON) violated, update "IDMTC"."ADDRESS_TYPE" set "ID" = :b1, "CODE" = :b2, "NAME" = :b3, "LOV_SORT_ORDER" = :b4, "DESCRIPTION" = :b5, "EFFECTIVE_DATE" = :b6, "EXPIRY_DATE" = :b7 where "ID" = :p_pk_col
    Unable to process update.
    Is there a way to inject, detect and/or replace this with a friendlier business user message? I have confirmed that the "Unable to process update." text at the bottom below the MRU Internal routine error raised from my check constraint is the process error message for my Apply MRU process.
    I was hesitating going down a larger page level validation where I loop through the tabular form array and/or inject some client side Javascript.
    Any advice? Have I simply overlooked some tabular form options for validating using cross column values?
    Thanks,
    Jeff

    Jeff..Thanks for the response.
    However because I am working in a tabular form at design time I don't know which controls I can reference in a dynamic action, or custom Javascript routine other than selecting all elements in a column using JQuery, etc.
    I have decided to go with for the time being an approach I found here: doing validation on tabular form
    My code ended up looking something like and was entered into a page level validation as a PL/SQL function body returning error text.:
    DECLARE
    l_error VARCHAR2 (4000);
    BEGIN
    FOR i IN 1 .. apex_application.g_f02.COUNT
    LOOP
    --If Expiry date is older then effective date
    IF nvl(apex_application.g_f08 (i), to_date('31-DEC-9999', 'dd-mon-yyyy')) < apex_application.g_f07 (i) THEN
    l_error :=
    l_error
    || '</br>'
    || 'Row '
    || i
    || ': Expiry date must be greater than effective date '
    || ' for maintenance item name: '
    || apex_application.g_f03 (i);
    END IF;
    END LOOP;
    RETURN LTRIM (l_error, '</br>');
    END;
    I had been hoping with Apex 4+ that there was additional native functionality to do this type of validation or somehow be able to reference a column or control name instead of a generic array column so that my code was better self documenting.
    It works for now...but would love to revisit with maybe a cleaner client side solution that does the validation and highlights the invalid element since I still maintain data integrity at the db with the check constraint.
    Thanks,
    Jeff

  • PHP Contact Form Validation - HELP!

    Hello,
    I've created my contact page on my website but I'm not happy with the validation and im getting emails through which are empty and with no contact details??
    Could someone please help me!
    This is my php code which is linked to my html page
    <?php
      $name = $_REQUEST['name'] ;
      $email = $_REQUEST['email'] ;
      $message = $_REQUEST['message'] ;
        mail( "[email protected]", "MDS2010 Enquiry",
        $message, "From: $email" );
      header( "Location: http://www.mammothdesignstudios.com/thanks.html" );
    ?>
    I have just used spry for validation but realise this is not the best way to go.
    Could someone view my code www.mammothdesignstudios.com/contact_us.html
    I'd really appreciate someones help on this,
    Thank you!

    You can create a simple validation as below:
    $error = array();
    if (empty($_REQUEST['email'])) {
         $error[] = "The email is empty";
    .... add any other validations u want.
    Then add this
    //check no errors
    if(!$error) {
         mail( "[email protected]", "MDS2010 Enquiry", $message, "From: $email" );
    Thus will prevent email to be send if there's any error occurs.
    On html page u can add this if u want.
    <p>
         <?php if ($error) {
                echo '<ul>';
                    foreach ($error as $alert) {
                    echo "<li>$alert</li>\n";
                echo '</ul>';
          } ?>
    </p>

  • Tabular form validation(Checkbox) is not working for Interactive report

    Hi,
    I am using the oracle apex 4.0 and oracle 11g.
    I have written a below select query on interactive report as
    select
    apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
    apex_item.text(3,RESNUM) as resnum
    from "PDRRES"
    and written the validation to display the error message( Function returning error text ) as
    DECLARE
    vRow BINARY_INTEGER;
    BEGIN
    -- apex_application.g_print_success_message := NULL;
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
    vRow := apex_application.g_f01(i);
    apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
    END LOOP;
    END;
    Output : No data found error message
    As far as it work for sql report with above logic because apex built in row selector
    but it fails in case of interactive report for some reason.
    Please suggest.

    Saroj Nayak wrote:
    Hi,
    I am using the oracle apex 4.0 and oracle 11g.
    I have written a below select query on interactive report as
    select
    apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
    apex_item.text(3,RESNUM) as resnum
    from "PDRRES"
    and written the validation to display the error message( Function returning error text ) as
    DECLARE
    vRow BINARY_INTEGER;
    BEGIN
    -- apex_application.g_print_success_message := NULL;
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
    vRow := apex_application.g_f01(i);
    apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
    END LOOP;
    END;
    Output : No data found error message
    As far as it work for sql report with above logic because apex built in row selector
    but it fails in case of interactive report for some reason.
    Please suggest.NO DATA FOUND usually occurs when an i mplicit select does not find anything. It can also occur when referencing a collection element that has not been defined.
    You have 2 collectinons in the code you posted, apex_application.g_f01() and apex_applciation.g_f03. Since you are looping therough the COUNT attribute of g_f01 its reference ("I") is probably okay and the value store in vRow is probably not right. You can check this by using RAISE_APPLICTION_ERROR to see the value something like
    raise_application_error(-20000,'vRow="'||vRo2||'"');Remember that working with checkboxes is tricky. If the box is not checked nothing will be sent. You may need to define a default value when no value is submitted.

  • MRU checksum error on tabular form - please help - is intermittent.

    Good old error
    "Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum = "84A1B18AC58C9ACF03A56DA81FD75F4A", item checksum = "557F9719C364FB3D758290FB612E5FBC"., update "HBMRX"."RX7B_NODE_ALLOC" set "NODE_ALLOC_ID" = :b1, "CALC_BASIS_ID" = :b2, "QUANTITY" = :b3, "FORMULA_FLAG" = :b4, "FORMULA_TX" = :b5"
    In the past when I have had this out of the blue I usually delete the region and recreate and all is fine. However I am having this error on a region in APEX 3.0 and have recreated and is intermittent.
    SQL for region is similar to:
    select
    "NODE_ALLOC_ID",
    "NODE_ALLOC_ID" NODE_ALLOC_ID_DISPLAY,
    "CALC_BASIS_ID",
    "QUANTITY",
    "FORMULA_FLAG",
    "FORMULA_TX"
    from NA
    where NODE_ALLOC_ID IN
    (select na.node_alloc_id
    from one source
    UNION
    select na.node_alloc_id
    from another source
    Updateable columns are:
    "CALC_BASIS_ID",
    "QUANTITY",
    "FORMULA_FLAG",
    "FORMULA_TX"
    I have removed all Select lists and made them text fields only. I have deleted the region and rebuilt from scratch - rebuilding the MRU and MRD processes.
    Most of the time it will save fine - but on about the 5th time it will error with a checksum error.
    EG - edit formula_tx - add 123 - SAVE - works
    then edit formula_tx add 123456 - SAVE - errors.
    This is occuring on about 5 pages where I have an identical region.
    Any ideas are very welcome !!

    Thanks for the response (handle changed)
    I have had some success today with my problem in finding there is one particular column that seems to be the cause (make it non updateable and the problem goes away) - so I will try and find out the reason for this and will post back.
    If I have no joy I will upload a similar scenario onto apex.com
    Marc - I am only updating one table (NA) - the criteria is looking in two places to show particular nodes which meet the criteria to be displayed on screen.
    select
    "NODE_ALLOC_ID",
    "NODE_ALLOC_ID" NODE_ALLOC_ID_DISPLAY,
    "CALC_BASIS_ID",
    "QUANTITY",
    "FORMULA_FLAG",
    "FORMULA_TX"
    select
    "NODE_ALLOC_ID",
    "NODE_ALLOC_ID" NODE_ALLOC_ID_DISPLAY,
    "CALC_BASIS_ID",
    "QUANTITY",
    "FORMULA_FLAG",
    "FORMULA_TX"
    from NA
    where NODE_ALLOC_ID IN
    (select na.node_alloc_id
    from one source
    UNION
    select na.node_alloc_id
    from another source
    where NODE_ALLOC_ID IN
    (select na.node_alloc_id
    from one source
    UNION
    select na.node_alloc_id
    from another source
    )

  • Null Validation in Tabular Form in APEX 4.2.2

    Hi to all respected Gurus of this Forum!
    Recently downloaded APEX 4.2.2. As we know that this version has some improved features and one is the best is i.e. *"Validation on Tabular Form".*
    For test purpose I succeeded to apply validation on field of tabular form and I am not allowed to "SUBMIT" data as per Validation Rule.
    But now, I want to customize that validation as per below logic.
    If required field is null than a message-box should appear with two buttons , as under:
    Blank field not allowed. Do you really want to submit? (Buttons should be = YES NO)
    If user press "YES" then validation should be false and record should be saved
    AND
    If user press "NO" then no data should be submitted/inserted as per validation logic.
    Please help. Your as usual cooperation is highly appreciated in advance.
    Regards
    Muhammad Uzair Awan
    ORACLE APEX Developer
    Pakistan

    Hello Sabine,
    >> I read about enhanced validation in 4.1 and would love to get rid of g_f-programming.
    The major “trick” is to associate the validation/process with a Tabular Form. On the first screen of both wizards, the first field is Tabular Form. You must select the tabular form on your page (currently there can be only one. In future versions this will change).
    Another factor that might influence the behavior of Tabular Form validation/process is the new attribute of Execution Scope. Unfortunately, you must enter Edit mode to gain access to this attribute (i.e., it can’t be set directly from the Tabular Form create wizard). Set it according to your need.
    The rest is very simple. You should treat your Tabular Form as a simple form, where every column header stands for a form item. The following is a very simple example of validating the SAL column:
    if :SAL < 1500 then
      return 'Sal Value is under 1500';
    else
      return null;
    end if;In this validation I’m using the Function Returning Error Text type.
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • Validation On Tabular Form

    How to implement validation such on TABULAR FORM
    select case when
    lead (IHL_PDATE) over (order by IHL_PDATE) > IHL_PDATE
    OR
    lead (IHL_PDATE) over (order by IHL_PDATE) is null
    'Ok'
    else 'Not Ok'
    end
    after or before submitting form?*
    I implement it on Table but I want to apply it to form?
    Regards
    Edited by: Siyavus on Sep 14, 2009 2:19 PM
    Edited by: Siyavus on Sep 14, 2009 2:28 PM

    Siyavus,
    Is your validation on the base table or a collection? Denes Kubicek has a couple examples of tabular form validation here:
    http://apex.oracle.com/pls/otn/f?p=31517:41
    Regards,
    Dan
    http://danielmcghan.us
    http://www.skillbuilders.com
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Validation problem on tabular form APEX 4.2

    Hi,
    My APEX Version is 4.2.
    I have problem with validations on tabular forms, for example : I have a column who must be numeric... when I get a character it is controlled properly, but it removes my line of the screen and he writes in the table below:
    state error:
    ORA-01403: no data found
    ORA-06510: PL / SQL: exception defined by the user untreated
    I Haven't this problem with this application on APEX 4.0
    PS : the validation was automatically create by APEX
    Regards

    Thomas,
    Is this a standard APEX tabular form validation, or a custom PL/SQL based validation? It might be easiest to diagnose what's going on there, if you could replicate this issue on apex.oracle.com, and point us to an example.
    Thanks,
    Marc

  • Tabular form number validtion is not working

    Hi,
    I have an tabular form with updatable columns which has datatype as number. i have created the in built tabular form validation "Item/value specified is numeric" for this updatable columns.
    when i entered any non numeric character like "asdasd" into this updatable columns. it shows me plsql error. PL/SQL: numeric or value error: character to number conversion error.
    can you please help me on this?
    Regards,
    Nilesh

    Hi,
    If you enter "asdasd" and get PL/SQL: numeric or value error: character to number conversion error , it only implies the right thing is happening.
    Maybe what you are alluding to is that the messages is not the way you want it. It should perhaps be "<column_name> must be numeric."
    What do you have in the Error Message item of this process? If is it null you are likely to get the message of the type you are getting.
    Did you by any chance try to change the default error message, which reads "#COLUMN_HEADER# must be numeric."?
    Regards,

  • Validate field in tabular forms apex 4.2

    Hi.
    i need help doing next validations :
    1.- i have a product_item field (wich is a lov and user choose one value), so i need to call a function (sending it the selected value product_item) that will return me some data about the product i selected, for example :
    if the function return 'A' then
    disable the next item on tabular form, lets say quantity
    else
    enable the next item on tabular form, lets say quantity
    end if
    2.- i need to determine the result of two items operations:
    total := final_quantity - start_quantity
    the user will introduce start and final quantity and i will determine the total.
    any ideas ?
    i am new on apex and need to do this on tabular forms.
    thanks in advance.

    Thomas,
    Is this a standard APEX tabular form validation, or a custom PL/SQL based validation? It might be easiest to diagnose what's going on there, if you could replicate this issue on apex.oracle.com, and point us to an example.
    Thanks,
    Marc

  • How to avoid submitting a page when tabular form rows are empty

    Hi,
    I have a master detail form in my application. There are 2 tables that are used Table A and Table B. Table A contains Ticket number and Table B refers to Table A through a foriegn key and Table B have columns like Date,Name, Age, ticket_id (that refers to the ticket_number of the Table A).
    This is how the application works:
    In a page there is a field for Ticket Number, once the user enters the Ticket Number and click Add Details, a tabular Form with 5 empty field appears... (Done through Page Process->Data Manipilation->Add Rows)
    This form contains fields Date, Name and Age. Once the user fills in all the details and click Submit button, the page is submitted. Whatever values that was entered is saved in Table B. Page Sucess message appears. This works fine.
    But once the Ticket Number is entered and Add Details is clicked, and without entering the values in the Tabular Form, if Submit button is clicked, there is no error showing up neither I see Page success message. But this should not be allowed. There should be some error showing up...
    Tabular Form Validations works only when user enters some values in the Tabular Form and click Submit. For the above scenario, where the form is untouched the validation doesnt work.
    How can I get this done? Any ideas?

    Hello Suzi,
    >> if (document.wwv_flow==null)
    The document.wwv_flow is an object representing the current form that was just rendered on your screen. As such, it can never be null.
    >> How to avoid submitting a page when tabular form rows are empty
    The correct way, especially for versions prior to APEX 4.0 is to use JavaScript, but for that, you need to know and understand how APEX generates your tabular form, HTML wise.
    To be very brief, APEX attached a unique ID to every updatable cell in the tabular form, using a certain pattern – each updatable column is getting a unique name (e.g. ‘f01’,’f02’ etc.) and the ID of a cell is a combination of this name with the serial row number the cell is on. For example, a cell on the third row in an updatable column called ‘f04’ will be given an ID of f04_0003. (More detailed explanation, with an example, can be found in my book).
    What you should do is to check these cells according to your validation policy (e.g. is all five row must be filled, is all the columns in a specific row must be filled, etc.).
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

Maybe you are looking for