Search This Blog

ADF - Display value based on selection in LOV

I have a form with 2 fields, Severity and Priority. User will select a value from Severity LOV, and based on the value selected, Priority will get its value.

The problem is when I am saving the form, only the Severity value gets saved in the database, while Priority is set to null, even though I can see the Priority value displayed on the screen while selecting from Severity LOV in the form.

Bind the valueChangeListener property of the LOV with valueChanged method. This is the code of the method:

    public void valueChanged(ValueChangeEvent valueChangeEvent) {
        //The selected value doesn't get updated to the model by the time ValueChangeListener gets 
        //invoked. This will update the model
        JSFUtils.setExpressionValue("#{bindings.Severity.inputValue}", valueChangeEvent.getNewValue());
        Object selectedValue = JSFUtils.resolveExpression("#{bindings.Severity.attributeValue}");
        System.out.println("selectedValue: " + selectedValue.toString());
        String priority = null;
        if (selectedValue.equals("MINOR")) {
            priority = "LOW";
        } else if (selectedValue.equals("FATAL")) {
            priority = "HIGH";
        } else if (selectedValue.equals("MAJOR")) {
            priority = "NORMAL";
        }
        System.out.println("priority: " + priority);
        JSFUtils.setExpressionValue("#{bindings.Priority.inputValue}", priority);
    }

No comments:

Post a Comment