Forum Stats

  • 3,770,020 Users
  • 2,253,049 Discussions
  • 7,875,269 Comments

Discussions

conditionally make a field mandatory based on other field value - ADF

User_1KZ3N
User_1KZ3N Member Posts: 31 Red Ribbon
edited Aug 9, 2018 5:50AM in JDeveloper and ADF

Hi All,

I working on requirement where I have a make field mandatory based on the other field value in the form.

Lets say if Customer ID is present then customer name has to be mandatory, else optional.

I am trying to perform this while inserting a new record into the table using ADF but I am not sure about how this can be implemented.

I have tried the method mentioned int his blog but no luck. kindly help.

Andrejus Baranovskis Blog: Conditionally Required Fields in Oracle ADF Faces Rich Client

JDEV version 12.2.1.3

Thanks !!

Tagged:

Best Answer

  • Ajay Taneja
    Ajay Taneja Member Posts: 1,413 Bronze Trophy
    edited Aug 9, 2018 4:46AM Accepted Answer

    Show Required will only give you an asterik on the component. For it to actually be mandatory you must implement the same on required attibute of the component.

    Having said that if your issues is resolved, close the ticket for future reader's benefit.

    Ajay

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,669 Red Diamond
    edited Aug 8, 2018 3:42PM

    Have you tried the application from the blog or have you tried to implement it yourself?

    Timo

  • dvohra21
    dvohra21 Member Posts: 14,253 Gold Crown
    edited Aug 8, 2018 3:52PM

    Conditional EL expressions could be used. But, not clear, if Customer ID is not specified and neither is Customer Name how is a customer data identified?

    What is the primary key? Make Customer ID pk and customer name optional.

  • Ajay Taneja
    Ajay Taneja Member Posts: 1,413 Bronze Trophy
    edited Aug 9, 2018 1:41AM

    As advised you can make use of EL in required property to make it mandatory. For this to be effective EL must come true and you can set autosubmit and ppr on the attributes for it to be effective.

    Do share what is the hurdle you are facing while doing it.

    Ajay

  • User_1KZ3N
    User_1KZ3N Member Posts: 31 Red Ribbon
    edited Aug 9, 2018 2:57AM

    Hi ,

    i am trying to make it work like this, i am able to make it a required field for single condition , but if i have given multiple expression its not working i am not sure whether i am doing it in the right way

    Working:

    showRequired="#{bindings.PlatformName1.inputValue == 'Oracle'}"

    Not working when i add one more condition say

    showRequired="#{bindings.PlatformName1.inputValue == 'Oracle'} or #{bindings.PlatformName1.inputValue == 'SAP'} "

    kindly let me know. Thanks!

  • User_1KZ3N
    User_1KZ3N Member Posts: 31 Red Ribbon
    edited Aug 9, 2018 3:04AM

    Hi,

    Kindly ignore this..i have changed the expression as mentioned below now its working.

    showRequired="#{bindings.PlatformName1.inputValue == 'Oracle' or bindings.PlatformName1.inputValue == 'SAP'}"

  • Ajay Taneja
    Ajay Taneja Member Posts: 1,413 Bronze Trophy
    edited Aug 9, 2018 4:46AM Accepted Answer

    Show Required will only give you an asterik on the component. For it to actually be mandatory you must implement the same on required attibute of the component.

    Having said that if your issues is resolved, close the ticket for future reader's benefit.

    Ajay

This discussion has been closed.