Checking the referential integrity of a form before the presentation of the Page element

Hi, OTN,.

I have a form on a table with multiple columns, some of which are foreign keys to other tables. Rather than validate the columns for referential integrity when the user inserts/changes in shape, I would use a dynamic action to attract the attention of the user with a javascript alert() when the user loses focus of the element. After a user enters a value into the text box and moves to the next item, I want to be able to query the table, check the existence of the value of the user and issue a javascript alert() if there is no match.

What is the best way to go about this?

I created a dynamic action-to run PL/SQL code on one of the elements of the page, with a code similar to the following:

DECLARE
rf_check varchar2 (30);
BEGIN
SELECT col1 INTO table_a FROM rf_check
WHERE col1 =: P1_ITEM_FK;
EXCEPTION
WHEN NO_DATA_FOUND THEN
HTP.p ("< script type =" text/javascript"> ');
HTP.p ("alert ("ERROR");");
HTP.p ("< /script >" ");
END;

I could not get the dynamic action of delivering javascript. Any thoughts?

Thank you

Matthew Moisen

Published by: Matthew Moisen on 25 October 2012 14:22

Matthew Moisen wrote:
What is the best way to go about this?

I have to admit that I've never tried, but I would be surprised if Javascript back via statements made htp.p that they are actually executed by the browser.

I would do something like that, by a dynamic action that calls an application process. The PL/SQL procedure request would return via htp.p OK or ERROR. From this result, the javascript would determine to issue the alert. Something like the following (not fully tested):

Javascipt

 var get = new htmldb_Get(null,html_GetElement('pFlowId').value, 'APPLICATION_PROCESS=FK_CHECK',0);
 var fk_check = get.get();

 if (fk_check=='ERROR')
  {
   alert('ERROR');
  }

Application Process FK_CHECK

DECLARE
  rf_check varchar2(30);
BEGIN
  SELECT col1 INTO rf_check FROM table_a
  WHERE col1 = :P1_ITEM_FK;
  HTP.p('OK');
EXCEPTION
  WHEN NO_DATA_FOUND THEN
     HTP.p('ERROR');
END;

Tags: Database

Similar Questions

  • Result passage of PL/SQL code for the page element

    Hello

    I have created a process in after the header to fill data to the page of the form elements.  The pl/sql code is like bellows.  Then I got the error message:

    ORA-06502: PL/SQL: digital or value error: character number conversion

    My question is that I do not see the difference in format between the page element and block pl/sql variables (e.g. : P31_STUDY_ID vs v_P31_STUDY_ID), they are either numeric or text field (in fact I have hidden field, but don't see conversion back to the digital field solved the problem).  And don't see needs to set the format mask.  Is there another way to detect the column that causes the problem, or if there is a syntax error with my assignment (from the variable element on the page)?  Thank you very much!

    ============================

    Declare

    number of v_P31_STUDY_ID;

    number of v_P31_STUDY_SITE_ID;

    v_P31_STUDY_SITE_NAME VARCHAR2 (255);

    v_P31_STUDY_SITE_NUM varchar2 (10);

    number of v_P31_STUDY_SITE_NAME_NUM_ID;

    number of v_P31_STUDY_SITE_OPEN_STATUS;

    v_p31_comments VARCHAR2 (255);

    Start

    Select

    tbl_study_site.study_id,

    tbl_study_site.study_site_id,

    study_site_name,

    study_site_num,

    STUDY_SITE_NAME_NUM_ID,

    STUDY_SITE_OPEN_STATUS,

    Comments

    in

    v_P31_STUDY_ID,

    v_P31_STUDY_SITE_ID,

    v_P31_STUDY_SITE_NAME,

    v_P31_STUDY_SITE_NUM,

    v_P31_STUDY_SITE_NAME_NUM_ID,

    v_P31_STUDY_SITE_OPEN_STATUS,

    v_p31_comments

    of tbl_study_site, tbl_study_site_attrib

    where tbl_study_site.study_id =: p30_study_name

    and tbl_study_site.study_site_id = tbl_study_site_attrib. STUDY_SITE_ID

    and tbl_study_site_attrib. STUDY_SITE_ATTRIB_ID =: P31_STUDY_SITE_ATTRIB_ID;

    : P31_STUDY_ID: = v_P31_STUDY_ID;

    : P31_STUDY_SITE_ID: = v_P31_STUDY_SITE_ID;

    : P31_STUDY_SITE_NAME: = v_P31_STUDY_SITE_NAME;

    : P31_STUDY_SITE_NUM: = v_P31_STUDY_SITE_NUM;

    : P31_STUDY_SITE_NAME_NUM_ID: = v_P31_STUDY_SITE_NAME_NUM_ID;

    : P31_STUDY_SITE_OPEN_STATUS: = v_P31_STUDY_SITE_OPEN_STATUS;

    : P31_COMMENTS: = v_p31_comments;

    end;

    =============================

    Identify the root cause. He's always on the format of the column, there is an error.  Thanks for your help.

  • Can not set a value by the executed dynamic action on the page element "selection list."

    I created an agenda of the page 'list of selection' and I want to when I change a value in another element of the page set only 'screen '.

    I created a dynamic action on the page element "selection list" for this.

    These are the dynamic action attribute:

    When:

    ======

    Event: change

    Selection type: point

    Article: P29_PURCHASE_ORDER

    Condition: No strings attached

    Advanced:

    ========

    Scope of the event: static

    Identification:

    ==========

    Action: Set

    The ' Action Page when the changed value "attribute of the element of 'list of selection' = 'None', and when I run form the dynamic action run and set the value for once and do not update the value according to the change in the article"list of selection. "

    Note: when I change the previous attribute of 'Redirect and set', dynamic action run and properly value, but the value was hidden soon

    I want to value when the value of change of select list according to this change successfully.

    Please, advice me,

    Best regards

    Mustafa Ezzat

    Hello

    you set the value of the 'Page elements to submit' to P29_PURCHASE_ORDER?

    Then, the SQL statement would use the current selected value.

    This is the help text says: "specify a list separated by commas of the elements of the page that will be submitted to the server and therefore available for use in your"SQL statement"," PL/SQL Expression"or"Body of the PL/SQL function".»

    Kind regards

    Erik-jan

  • Display the values of the Page element in HTML table

    Hi all

    could you please help me with the below? I want to have a table in the HTML area and to display in the table of elements of the Page of the page.

    I got the code like this:
    {
    < table >
    < tr > < td > & P1_ECEMEA_ASSISTANCE < table > < /tr >
    < tr > < td > & P1_ECEMEA_WIP < table > < /tr >
    < /table >
    }
    It shows the element of the Page names in the form of text, not the values.

    However, this code without the tags table:
    {
    ECEMEA request for Assistance of the CQT: & P1_ECEMEA_ASSISTANCE.
    ECEMEA CQT Work in Progress: & P1_ECEMEA_WIP.
    }
    Works and Page element values are displayed.

    Is it possible to display the values of the Page element in the HTML table at all or should I use a different method to show the values in a table? The above is only an excerpt of the code. I need to display about 30 items in Page, put in shape in a table with headers.

    Please let me know what kind of region is the best to use, or if I have to use only a few symbols of escape in the table code...

    Thank you and best regards,

    Vladimir

    Vladimir,

    Looks like you're missing the period after the substitution variables.

    {
    
    &P1_ECEMEA_ASSISTANCE.
    &P1_ECEMEA_WIP.
    }

    -D.

  • How to position the page element?

    Hello

    I created a report in the same region, has also created a page element in the same region. The page element is now on the top of the report, but I need to show in the report. How can I achieve that?

    Thank you

    Victor

    Depends on your version of the apex. 4.1/4.2ish there is an attribute on the region of the "Position of the display element.

    Enter this below content.

  • How to use the value of the page element in other pages too?

    Hi all

    How to pass the value of the item P26_NO from 26 to all other pages (such as 1, 2, 3... 25) using the & P26_NO. ???
    I set the default for this item.but I can't able to find value in the session state itself?

    Please post your suggestion here!

    Thank you and best regards,
    Robette.

    Robette wrote:
    Hi Amelia,.

    Through application process only we can able to save the page element value in session state? is there another way?
    Since my requirement is like I need to display footer text in all the pages, I have the version number included in this text, so I created a table and my intention to create an item and passing the point value for all other pages and see that point value & P26_NO. in the text. Version number is dynamic, it will change at each deployment.
    Is another way simple, other than my approach?

    Thank you best regards &,.
    Robette.

    You should use point demand for it and an application process to fill

    IF :APP_ITEM_NAME IS NULL THEN
      APEX_UTIL.SET_SESSION_STATE('APP_ITEM_NAME','myvalue');
    END IF;
    

    Published by: VC on June 25, 2012 13:48

  • JavaScript allows you to change the value of the page element?

    How to use JavaScript to change the value of the page element?
    I can read the value of the page element.

    I can change it by JavaScript?

    Thank you.

    David

    Depends on what is the type of page element - for text/no Select something like:

    function setValue(){
      $x('P1_FIELD').value = 'Oracle';
    }
    

    For a select element, something like this:

    function setSelectValue(){
      html_setSelectValue('P1_SELECT', 'Oracle');
    }
    
  • Check the page in my basket?

    Hi - I want to add a page to check the payment procedure where a customer can check, modify and verify their purchase information before clicking on 'submit '. Does anyone know how to do this?

    Thank you

    I guess you want a page with all the information, including their details of shipping, names, address, etc, more information basket and sort of button large transaction confirmation. You can do two ways.

    1 client side with a "confirm page" generated by javascript, basically, you pass the content of the page.

    Pro: easier to implement, total client-side.

    Cons: Simple solution, but sometimes it's all you need.

    Example:

    http://jsfiddle.NET/AMjkN/

    Remove:

    http://forums.Adobe.com/message/5612324#5612324

    2. create your own control by using the API.

    Pro you can control everything in what concerns the ordering process and easy integration with other systems, you may have in place.

    Cons: more than one business solution. Requires an external hosting and has fees monthly (hosting) the initial development costs.

  • How to check the page dirty with default values existing in viewObject?

    Hi all

    I use JDeveloper 11.1.1.4.

    I have two pages in my application. I am browsing for page2 page1.

    Before opening page 2 I created new line page 2 notice of object using method 'Create Insert()' with some default values by using the ViewRowImpl class.

    My problem is that I have a button to return to Page 2. If I click the back button, then check the Application module is dirty or not.

    But it always shows AM is dirty due to I'm setting some default values in ViewRowImpl. If I avoid the default values in ViewRowImpl then AM dirty check works fine.

    My Question is how to check the AM (or) dirty Page with default values in the object view?

    My bean Codes:

    Links DCBindingContainer = (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();

    DataControl dc = bindings.findDataControl("AppModuleDataControl");

    ApplicationModuleImpl am = ((ApplicationModuleImpl) dc.getDataProvider ());

    If (am.getDBTransaction (.isDirty (()))

    {

    return "Page is dirty."

    }

    My Jspx Codes:

    < af:commandLink id = "cl6" text = '2 '.
    shortDesc = "Add Row in Page2"
    actionListener = "#{bindings." Action CreateInsert.execute}' = 'Edit' >

    Thank you

    David...

    see this

    http://www.techartifact.com/blogs/2013/11/how-to-check-ifdirty-is-modified-for-view-object.html

    http://www.jobinesh.com/2011/05/checking-for-dirty-data.html

  • How to check the page on dreamweaver cc? Check the page button not on the files tab.

    I'm checking the links in Dreamweaver CM³. Are the steps that I'm supposed to use file > check page > links. But the review page option is not available. How can I do this is that the button is not there? Thank you!

    It sounds as if you follow the obsolete. I do not remember there ever be an option in the file menu to check the links on a page. To check the links, you must go to the Site > Check links to the site level.

  • Check the page is visible

    I use weboverlay with html and javascript content to implement an audio file that starts to play according to the devicemotion event.

    Everything works except the blows of the user to the next page of the oder, the sound begins to play too by moving the unit.

    How can you check if the page is visible?

    I tried to check using javascript, but DPS it always returns true for beeing viewport and visible.

    Any ideas?

    Set the overlay of web to AutoPlay with 0.125 seconds behind. Then it loads only when it is actually on the screen. You can also use the onAppear and onDisappear events, but those who do not work on Android or Windows.

    Neil

  • custom layout and update the page elements

    Hello

    I'm working on an APEX application, I need a page to view issues and alternative options, such as only choose radio group or mutiple shoose by box. The user will then check the answers. After the answer questions, send the page to get the score.

    The presentation must be: separate regions by the kind of question. in each region, the question in the first line; the four options in the second line, the checkbox or a radio Fund; in the bottom of the page, there is a button "submit".

    The tables are designed as follows,
    create the table RULE_QA_SHEETS
    (
    SHEET_ID NUMBER of non-null,--ID for the answer of the question sheet
    Category NUMBER not null, - use a tmplate to build the leaf, for example, numbers of gender issue, easy or difficult
    PERSON_ID NUMBER not null,-the user who was answering questions
    DATE OF ANSWER_DATE,
    NOTE VARCHAR2 (4000 TANK)
    )

    create the table RULE_QA_SHEET_ITEMS
    (
    ITEM_ID NUMBER not null,--ID for the question in this form.
    SHEET_ID NUMBER not null,--master id of the table.
    QUESTION_ID NUMBER not null,--ID for the issue in the inventory.
    MEET VARCHAR2(30 CHAR) - the answer the user checked, will be compared to the inventory. Once the user to submit the page, this column will be updated.
    )

    I've not found a good report APEX model, and I can use dynamic content plsql to generate the layout but no idea how to upgrade the right answers.

    Everyone has the same experience, or give me a help, that would be great!

    Thank you!

    Chongwu says:
    Here is the connection info.
    Workspace: CHONGWU
    User: dev1
    Password: 1qaz2wsx
    Answers and the Question of enforcement 42990

    Could you please give me an example of this? page 15, pls help to control dynamic pl/sql region that generates the page layout.

    See page 150 in your application. I started with a copy of your page 15 and brought some changes in regions of dynamic PL/SQL to produce more semantic HTML by using ordered lists and labels. Labels provide also bigger clickable/tangible goals by answering the questions.

    declare
    
      i number := 1;
    
    begin
    
      htp.p('
      '); for q in ( select q.qa_id , q.question , q.answer_a , q.answer_b , q.answer_c , q.answer_d from rule_qa q where q.question_type = 'S') loop htp.p('
    1. ' || q.question || '
        '); htp.p('
      1. ' || apex_item.radiogroup(i, 'A', null, p_item_id => 'q-' || i || '-a', p_item_label => q.answer_a) || ''); htp.p('
      2. ' || apex_item.radiogroup(i, 'B', null, p_item_id => 'q-' || i || '-b', p_item_label => q.answer_b) || ''); htp.p('
      3. ' || apex_item.radiogroup(i, 'C', null, p_item_id => 'q-' || i || '-c', p_item_label => q.answer_c) || ''); htp.p('
      4. ' || apex_item.radiogroup(i, 'D', null, p_item_id => 'q-' || i || '-d', p_item_label => q.answer_d) || ''); htp.p('
      '); i := i + 1; end loop; htp.p('
    '); end;

    Some CSS is required for formatting required and to get the labels actually appear:

    ol.questions>li {
      margin-bottom: 1em;
      font-weight: 600;
    }
    ol.answers {
      margin: 0.5em 2em;
      list-style: lower-alpha outside;
    }
      ol.answers>li {
        clear: left;
        margin: 0.5em 0;
        font-weight: 400;
      }
      ol.answers>li span {
        display: inline-block;
      }
      ol.answers>li label.hideMeButHearMe {
        position: static;
        top: auto;
      }
      ol.answers>li input {
        float: left;
        margin: 0 0.5em 0 0;
        padding: 0;
        vertical-align: middle;
      }
    

    Finally, there is a simple process that records the answers in a collection of the APEX. Collections are frequently used apps Q & A and survey to store responses temporarily before their final transformation:

    declare
    
      answer varchar2(32767);
    
    begin
    
      /*
        Create or empty the APEX collection used to temporarily store the user
        responses.
      */
      apex_collection.create_or_truncate_collection('ANSWERS');
    
      for i in 1..50
      loop
        /*
          Dynamically capture the contents of each apex_application array...
        */
        execute immediate '
            begin
              :1 := apex_util.table_to_string(apex_application.g_f' || to_char(i, 'fm09') || ');
            end;'
          using out answer;
    
        wwv_flow.debug('apex_application.g_f' || to_char(i, 'fm09') || ' = ' || answer);
    
        /*
          ...and if there's a response then record it in the collection.
        */
        if answer is not null
        then
          apex_collection.add_member(
              p_collection_name => 'ANSWERS'
            , p_n001 => i
            , p_c001 => answer);
        end if;
    
      end loop;
    
    end;
    

    It appeals to a rather horrible dynamic assessment of the apex_application tables. As Howard points out, there is only 50 of these paintings, which can be limited if you plan to have more than 50 questions. A common way to avoid these two problems is to present only one question at a time (turn-off to back on the same page in a sort of Pseudo-Assistant until all questions are answered), so you only need to refer to a single table, known.

    Note, however, that I am not keen on this model of single table. You can consider using a more flexible and extensible model as in This example.

  • Call to the database to fill the page elements

    I work in Apex 4.0.

    I have a redundancy of the data I want to continue (I know, bad form). I have a table of name and address in which each name has a unique identifier. I have another table where I want the same information to be saved if the unique identifier is the same as the table name and address. Is it possible to recover these data name and address, when the cursor loses focus on the unique identifier page element? What is the kind of thing that will make an AJAX call? If so, how?

    Here's a 3.x way to do it via AJAX
    http://www.itworkedyesterday.com/blog/2010/2/23/apex_util-ready-set-JSON.html

    But as mentioned, you can create dynamic actions and assistants should guide you through most of the obvious options.
    That is to say - create an onChange DA that makes a setValue of your element using PL/SQL and so on

    Scott

  • Value of the page element in the APA process not maintained after the send this page

    Hello - I have a sequence of events that goes like this:

    (1) region 0 REG_1 Page is rendered before footer
    -REG_1 region uses javascript / AJAX to call App process PROC_1
    -PROC_1 defines Page1 item PAGE1_MESSAGE for X
    -After that PROC_1 runs correctly, REG_1 don't doSubmit()

    (2) region 0 REG_2 Page is rendered before footer; in this case
    After the page sent by REG_1. (Requirements to ensure that)
    REG_1 has not yet reached)
    -REG_2 region shows an alert PAGE1_MESSAGE (= X).
    -REG_2 region uses javascript / AJAX to call App process PROC_2
    -PROC_2 sets page 1 point PAGE1_MESSAGE to Y
    -PROC_2 sets point Application DEBUG to PAGE1_MESSAGE (this is for debugging)
    -PROC_2 defines the point of Application APP_MESSAGE to Y (this is also for debugging)
    -After that PROC_2 runs correctly, REG_2 don't doSubmit()

    (3) after that REG_2 sent the page, here's what I have:
    -Point application APP_MESSAGE = y. good. That's what it has been for PROC_2.
    -Point Page 1 PAGE1_MESSAGE is bad. X. That's what he has been put to in PROC_1.
    -Point application DEBUG = y. good. This shows at least that PAGE1_MESSAGE was
    the value Y in PROC_2... but for some reason this value is not be kept
    After the application process is running.
    -There's that several other elements of the application located in PROC_2, and they are all correct.


    Any ideas as to why this is happening? It seems like it should be
    quite simple: set the value, send page, the value must be that
    I put it.

    Thank you
    Carol

    Hello

    Exhibition (doesnot save session state), I am not changing who is P1_MESSAGE_1.

    Why does that matter? Why does the hidden item behave differently?
    

    Yes, Hidden Items by usually default state saves. But this isn't the problem in this case because I had changed the item to display only (state saved) and that did not help. Finally back in doesnot save state.

    Try to replace alert (ajaxResponse); with the lines below

    $s('P1_MESSAGE_1',ajaxResponse);
    alert($v('P1_MESSAGE_1'));
    

    Maybe the session state is defined (server), but the value in the DOM HTML (browser) to P1_MESSAGE_1 is not defined. If adding the line above works then the hypothesis is correct.

    And I see that you made the source "static" assignment ...
    

    Yes, I made this change, because it was a reference in itself I think it was redundant. And I had to correct what I thought is not just before debugging. Which cannot be linked to the problem though.

    Kind regards

  • Set the value of the page elements using apex.submit

    Hey,.

    Does anyone have an idea how to set the value of several page elements using apex.submit?

    Here is my request, she works for this element of the page, but I want to first the value of the other elements of the page (i.e. P30_SHOW_REF) as well.

    select s.nr as NRR, 
    '<input type="button" value="clickme2" onclick="document.getElementById(''BUTTONS'').style.display = ''block'';apex.submit({request:''SET'',set:{''P30_KLT_NR'':'||s.nr||'});"/>' Button 
    from klant s
    

    Thanks in advance!

    Hi Julijan,

    Here is the example:

    apex.submit({
      request:"DELETE",
      set:{"P1_DEPTNO":10, "P1_EMPNO":5433});
    

    Concerning

    J

Maybe you are looking for