Conditional validation - When field changed

APEX 4.2.1
Simple wizard-generated DML form on a table. Hidden numeric primary key (PK), displayed multi-column unique key (UK1,UK2); standard table design.
Combination of conditional readonly and editable page items. NOT EXISTS validation to replace ORA-0001 with a friendlier error message. Validation should fire only when key fields (UK1 or UK2) are changed. Changes to other fields on the record should be allowed.
But APEX server side conditions don't track item level changes. For instance, we can't say "Fire this validation only when P1_X or P1_Y are changed"
How would this sort of thing be done? By adding OnChange dynamic actions on all the page items of interest to set a hidden page item, save that to session state and refer to it in the validation's Condition?
Is this the right way to approach this?
Thanks

VANJ wrote:
APEX 4.2.1
Simple wizard-generated DML form on a table. Hidden numeric primary key (PK), displayed multi-column unique key (UK1,UK2); standard table design.
Combination of conditional readonly and editable page items. NOT EXISTS validation to replace ORA-0001 with a friendlier error message. Validation should fire only when key fields (UK1 or UK2) are changed. Changes to other fields on the record should be allowed.
But APEX server side conditions don't track item level changes. For instance, we can't say "Fire this validation only when P1_X or P1_Y are changed"
How would this sort of thing be done? By adding OnChange dynamic actions on all the page items of interest to set a hidden page item, save that to session state and refer to it in the validation's Condition?
Is this the right way to approach this?Not in 4.2 in my opinion. Drop the validation, let the DML process raise the ORA-00001 exception, and use the new error handling features to provide a user-friendly message.

Similar Messages

  • Conditionally Validating InputDate Fields...

    Hi !. My problem is the following one: My project let the user download some reports in excel format. I have like 6 sections each one with a buttom and 2 input date calendars. The thing is that, when the user enters data (let say "asd") and he tries to download another report from another section, a validation appears on a field from another section and the user cant download the report. I tried using af:subForm but I realized that that is for the binding layer not if I am using a convertDateTime for instance... So, what i thought is adding to every buttom a setActionListener to know which buttom was pressed and in a CustomConverter get a reference of it and don't raise up a message for a field that it is not contained in the section of the buttom. The problem is that I can't get a reference to that variable... Does anyone knows if there is another chance ?. Thankx.

    <p>So you want to keep the Group Header (GH) and the Details (D), but suppress the Group Footer (GF) if the count of details records is 1...</p><p>Open the section expert (right click on the grey sections to the left of the canvas) - make sure you have the GF highlighted.</p><p>There is an option named "Suppress" - to the right of that is a formula box [X+2].  Click on that and use a conditional formula for the suppresion.</p><p>Formula:</p><p>if Count({Customer.Customer ID}, {Customer.Customer Name}) = 1 </p><p>then false else true </p><p> </p><p>Note: you will need to replace {Customer.Customer ID} for some field in your details section and {Customer.Customer Name} in the formula with appropriate fields from your report. </p>

  • FMS Auto Refresh when Field Changes

    I have a client who wants to see the Sales Order # (ORDR.DocNum) in their UDF so it is easily visible from every related document.  I am currently auto fillling the sales order number when there is a change in their Customer PO# (ORDR.NumAtCard).  This works well except for the following instance: 
    They will draft multiple sales orders at one time and then add them (multiple users).  Each time a new window for sales order is opened it contains the same sales order number as the already opened screen.  They then fill in their information which auto fills the UDF with the sales order number for the current window.  Once the sales orders are actually added, only the first one contains the correct sales order.  The other sales orders are changed automatically by SAP as you cannot have duplicate numbers.  The related UDFs, however, are not updated.
    I's there a field that can be selected to Refresh the UDF when the "Add" or "Update" button is selected?

    Phil,
    A Sales Order ones added to the system will get a DocNum which is permanent.  Do the UDF update need to happen only when the document is actually added to the database.  You can completely ignore Update as this does not change the DocNum.
    To get the correct DocNum instead of duplicates in case of draft's or other scenario's the DocNum should be filled in the UDF through the SBO_SP_TransactionNotification stored procedure.
    This stored procedure lets you add your own SQL code inside it and will execute each time a database action takes place.
    You can access this SP from SQL Server inside your company's DB > Programmability
    If you search the term SBO_SP_TransactionNotificatio in this Forum you will find many examples to get started.
    The key values @transaction_type and @object_type
    @object_type = '17' ...................stands for Sales Order
    You can check this sample below
    IF @transaction_type = 'A' AND @object_type = '17'
    BEGIN
               UPDATE ORDR SET U_YourUDF = DocNum WHERE DocEntry = @list_of_cols_val_tab_del
    END
    NOTE: U_YourUDF should be replaced with the name of your UDF
    Suda

  • Bypass Required Field Validation when needed in PDF Dynamic Form

    I faced a tricky situation, where some fields are required, but we need to allow bypass required (mandatory) validation rule when saving the form, and require to fill such fields when submitting the form. In other words, provide flexible control when to turn On / Off this feature.
    I wanted to implement a flexible solution, and I will post my findings here. Appreciate your feedback for improvements.
    Steps:
    1. Mark rquired fields as required.
    2. Specify "Empty Message" as "This field cannot be left blank", or similar.
    3. Specify "Validation Script Message" as "This field must have a proper value before submit", or similar.
    4. Create a Global Form Level Variable something like "StopTotalValidation" and default as "1" means by default, Turn Off Validation for some cases.
    5. For the fields which require this type of control, add the script (to be defined later) on the "validate" event:
    myTools.validateForRequiredField(this);
    6. Create a Script Object "myTools" and add the following script:
    function initStringFunc() {
    //call this function on Document Initialize
    String.prototype.trim = function() {
        return this.replace(/^\s+|\s+$/g,"");
    String.prototype.ltrim = function() {
        return this.replace(/^\s+/,"");
    String.prototype.rtrim = function() {
        return this.replace(/\s+$/,"");
    String.prototype.isEmpty = function() {
        return (this == null) || this.trim() == "";
    function setNodeProperty(theNode, theProperty, newValue) {
       if (theNode[theProperty] != newValue) {
            theNode[theProperty] = newValue; 
    function isNodePropertyEmpty(theNode, theProperty) {
        var result;
        if (theNode == null || theNode[theProperty] == null) {
            result = true;
        } else {
            result = theNode[theProperty].isEmpty();
        return result;
    function disableTotalValidation() {
        StopTotalValidation.value = "1";
    function enableTotalValidation() {
        StopTotalValidation.value = "0";
    function isTotalValidationOn() {
        return StopTotalValidation.value != "1";
    function isTotalValidationOff() {
        return StopTotalValidation.value == "1";
    const conRequired = "(required)";
    function validateForRequiredField(theFld) {
        // Bypass Required Field Validation when Global Validation is Off.
        var result=false;
        if (theFld) {
            if (theFld.mandatory && theFld.mandatory == "error") {
                if (myTools.isNodePropertyEmpty(theFld, "rawValue")) {
                    myTools.setNodeProperty(theFld, "rawValue", conRequired);
                if (isTotalValidationOn()) {
                    if (isNodePropertyEmpty(theFld, "rawValue") || theFld.rawValue.toLowerCase() == conRequired.toLowerCase()) {
                        result = false;
                    } else {
                        result = true;
                } else {
                    result = true;             
        } else {
            result = false;
        return result;
    7. Now, on the click of "Save" button call the function "disableTotalValidation()" and on the click of "Submit" button call the function "enableTotalValidation()".
    I have just finished implementing the above solution, and as per my initial testing, it is working fine.
    I will post this to my Google Docs workspace, and provide updates their.
    Tarek.

    Hi Tarek,
    I see what you mean in relation to clarity if you used the form variable approach. It was only a suggestion. Like so many things in LC, there is more than one way to finding a solution to a problem.
    The triple equal sign (===) is testing if the condition is equal, but to a higher standard. It is testing if the values are identical to each other. For example if you were testing if a textfield was empty, with Equality (==) you might have this:
    if (this.rawValue == null || this.rawValue == "") {
         // Some script
    If you use Identity (===) you can do the same thing with less script:
    if (this.rawValue === null) {
         // Some script
    It is also useful when testing the value of an object, but also the type (eg string, number, Boolean).
    Lastly, it can be used for non-identity (!==).
    In relation to createNode() etc, apart from John's blog, it is covered in the LC documents: http://www.adobe.com/support/documentation/en/livecycle/documentation.html. Look for the scripting guides and the guide to the XML Form Object Model.
    Good luck,
    Niall

  • Condition Type Amount field is disappearing in Quotation when scroll down & scroll up is done

    Hi Friends,
    I am getting a strange issue in the Quotation.
    When i change the Contract Validity Period value in the Header section, a custom discount condition type will appear in the Conditions Tab. But the issue comes when i scroll down and scroll up the screen in Condition tab the amount value is disappearing. I debugged almost the whole functionality but still not able to get where the issue is happening.
    Any help on this regard is highly appreciated:)
    Please find the attached document for the reference.
    Regards,
    Santosh

    Hi Virginia,
    The description of the issue seems to indicate that the BOM is reset in ECC.   Can you have a look at note 380911 and consider the suggested settings?
    X: No structure is exploded in the R/3 system.
    Subitems are externally
    assigned via the BAPI interface. In particular, no free goods determination and
    no material substitution is executed in the R/3 back end either in this
    case.  .../...
    Best regards - Christophe

  • Syndicate only when few fields change

    Hi Gurus,
    There are 10 fields in the Main table. And the requirement is such that the auto syndication should happen only when Field 1 or Field 4 value changes (like change pointer triggering).
    I know there is an option while creating a syndication map to "Supress unchanged records" but this work for all the fields.
    I need to trigger the syndication only when Field 1 or Field 4 changes.
    Please help me achieve that.

    hi,
    There is one work around.
    We can achieve this requiremnt  through workflow.
    If feasible for you then try these steps :
    1.create one more field  that contain  information of field1 and field4 .
    2. Create one  validation that check whther the concatenation of field1 and field4 equals to the value of new field
    3.create an assignment that assign these two fields value to new field
    4.create onw workflow that run on record update.
       4.1 this workflow runs on each update of record
        4.2 second step do that validation that we created in step 2
        4.3 if  validation ok then end of workflow
         4.4 otherwise,run the assignemnt that created in step 3 and syndication step that syndicate  the records  whose either field1 and field4 value change.
    just check your feasibility with this approach and revert back if u need any other help.
    Thanks,
    sudhanshu

  • Disable validation when changing showdetailitem in showonetab

    Hello,
    i have a creation page for a table and since the table contains lots of columns i use showdetailitems to limit the size of the displayed page.
    But every time i change of showdetailitem, the validation of the fields is executed and i always get error messages saying that some fields are mandatory and must be set.
    so my question is, how can i disable validation when changing the selected showdetailitem (and still have it when committing) ?
    thanks
    -regards.

    Hello Peter,
    A little correction to Chris' suggestion, it should be:
    <af:inputText value="#{bindings.<your field name>.inputValue}"
                        label="#{bindings.<your field name>.hints.label}"
                        required="#{!bindings.<your iterator name>Iterator.findMode && bindings.<your field name>.hints.mandatory}">
    ...etc...The only difference is the removal of the ? : operator since it isn't required and represents both an additional parsing and processing effort. Go micro-optimization!
    ~ Simon

  • Mass change Condition valid to dates into Info record

    Hi,
    is there any mass changes for condition validity to dates into purchase info record?????
    i have check into MEMASSIN, there is field for conditions valid to Date,
    Pl. guide .
    Regards,
    Devendra

    Hi,
    It is not possible to  change validity date using MEMASSIN - Mass Maintenance t code.
    You need to create LSMW with recording method to achieve this. we are doing the same.
    It is very easy. And take care that while recording select the validity button and click executive to record the do not double click on the validity tab.
    Reg

  • ME47 price = 0 in overview when condition valid in future

    Hi Expert,
    I have a quotation with item 10 and 20 with the same material. When I update item 10 price with 1 and item 20 price with 2, the item 20 price will change to zero and gray. The info record also can not see any update in item 20. infoUpdate is "C".
    Item
    Material #
    Price
    Date from
    Date to
    10
    A
    1
    2015/5/5
    2015/5/6
    20
    A
    2
    2015/5/7
    2015/5/31
    I also checked below notes are implement in my system.
    586030 - ME47: price = 0 in overview when condition valid in future
    360746 - ME47: Update conditions in the info record
    428245 - ME47: Maintaining conditions, SAPSQL_ARRAY_INSERT_DUPREC
    Thanks,
    Leon

    You system is behaving correctly.
    You can see the net price = 0 at overview level, but you can see the original price at details condition level.
    You second line item's condition record is not valid for today's date, that's because it is showing 0 for overview screen. I hope your RFQ document date = 05.05.2015.
    For first line item, your condition record has validity = 05.05.2015 to 06.05.2015. (which is valid for today's date)
    For second line item, your condition record has validity = 07.05.2015 to 31.05.2015 (which is not valid for today's date)
    Change the valid from of the second line item = 05.05.2015, then you can see the price at overview screen.

  • Condition value not updated when qty changed

    hi all,
    I have created a new condition ZPR1 (copied from PR00) and use a new formula for it.
    There is a problem when I change the qty after the item is billed.
    Suppose the original qty is 1 and total ZPR1 price is 100. When I change the qty to 2, the ZPR1 price is still 100! It will change to 200 if the item is not billed.
    Anybody encounters such problem and how to solve?
    Thanks

    Hi,
    I don't mean to change the unit price.
    I mean the condition value (the item total price) is not updated
    You can't change the price anymore in the condition tab after you billed
    But when you change the qty of the item, the total value should change accordingly
    And I think for my case I should not cancel the invoice. Suppose original qty is 10, and there is partial shipment of 7 and billed the customer. Later customer request to reduce the qty to 7 to complete the item. We should not cancel the invoice in this case.
    Try to test with PR00 and PN00, you will see the item value will be changed according to the item qty.

  • Extractor (Delta) not recognizing a change when field is set back to blank

    Good Day Experts,
    Any pointers on the issue below will be appreciated:
    I have a Delta extractor which picks up the value from a field in ECC when the field is changed. When I initially assign date value, extractor picks up the change and everything works. 
    However, when I change the field in ECC back to blank, the extractor is not recognizing this as a change and hence it does not bring the new value into BI... so my master data in BI still the "old" value, even though the value has actually changed.
    Please let me know if you would like me to clarify...
    Cheers and Thank You,
    Dmitriy

    Hi....
    Here you have mentioned that Delta extractor which picks up the value from a field in ECC when the field is changed...........is it a date field ? or time stamp.....
    Unfortunately I can't check this datasource in my system.....
    But when delta is coming based on this field..........if this field is blank then obviously delta will not get captured.........why this field in ECC is not getting updated ?
    Regards,
    Debjani......

  • Change "valid to" field in Profit Center master collectively

    I want to change "Valid to" field in Profit Center master collectively, e.g. from 31.12. 9999 to 31.12.2010. I have tried KE55(mass change profit center) but it seems the "Valid To" field is greyed out, i.e. not able to change this field in massive change.
    Therefore, I have to go to KE52>change valility period to shorten the "valid to" filed invidiually. There are too many profit centers i have to change.
    Is there any way to change this field in mass change configuration?
    Regards,
    Frances

    Hi
    Use an LSMW to do this task... It has to be done from KE52... So, better to create an LSMW
    Regards
    Ajay M

  • When we change the non-mandatory field in the form, it doesn't get updated

    Hi... I have one question here..
    If I have non-mandatory fields in a custom form, and when I query the form and change the value in the non-mandatory field and click on save, then it doesn't save. It says 'No Changes to Save'. But, it's not the same for non-mandatory fields.
    Can you please suggest me?
    -vrdida

    VRdida,
    If I understand correctly, you have a non-Required item in your form that has an LOV assigned. While this item is Required=No, it works correctly. When you change the Required property of the item to 'Yes' then it fails. When this occurs, do you get an error message? Are you able to select a value from the LOV?
    It sounds like the Required=Yes property might be preventing you f rom opening the LOV. Try setting the Module property: Defer Required Enforcement = Yes. This is the typical setting in an EBS form. This is what allows you to navigate out of a Required field if the value is NULL, but will give you a Required message when you attempt to save the record if the value is still NULL.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.
    Edited by: CraigB on Apr 6, 2011 11:43 AM

  • How can I detect when a text field changes in Cocoa-Applescript?

    I'm working on an application where I have one text field, and below it, a "Send" button. When the button is pressed, is sends whatever is typed in the field to all the user's Skype contacts. I have to prevent the user from sending a blank message to all contacts, so I have to change the button's setEnabled. I've been using an NSTimer to check every second, which works, but it lags my application hugely. Is there any handler that is run whenever text is added or deleted? Perhaps something like:
    on myTextFieldDidChange_(aNotification)

    A specific text field is not used in the handler call - the delegate method is called for all text fields.  In the case where you have several text fields, you can get the notification's object, for example:
    on controlTextDidChange_(aNotification) -- a text field changed, so check it out
      set thisTextField to aNotification's object() -- the current control being changed
      set theText to thisTextField's stringValue()
      log theText
      -- whatever
    end controlTextDidChange_
    Note that you need to connect the text field's delegate outlet to your AppDelegate (or whatever class you are using for the delegate).

  • Send designer workflow email when certain fields changed?

    Is there any way we can handle SharePoint designer workflow sending email. If certain fields only changes. 
    Like checking with previous value and and current values, if it is different and send email. Now I am able to sending email when list item changes, it doesn't matter which field changes. That way emails are flooding into inbox. 
    I want send emails when couple fields changes only. 
    Help is appreciated 
    ItsMeSri SP 2013 Foundation

    Yes very much possible to send email of specific fields change, however workflow will run on each edit but only proceed further when those specific field changes. Keep some hidden column which always will keep changed value for those column. When new value
    suppose to change, check with this hidden column values, if different then send mail and update else, stop workflow.
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

Maybe you are looking for