Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Pre Populated Error For Required Fields after button Click

User_9PGVKApr 4 2016 — edited Apr 4 2016

i have a table

Attachments with columns

attachment_id not null,

process_id not null,

employee_id not null,

file_path not null,

file_description not null

I created a table from the attachment collection by drag and drop attachment from the Data Control

I use CreateInsert operation to add a new row in table. on createInsert button click , call managed beand method addNewAttachment

i have a button that is a follow

<af:button text="Add New attachment" disabled="#{!bindings.CreateInsert1.enabled}" id="b9" action="#{ProcessesHandler.addNewAttachment}"/>

Managed Bean method is a follwed

public String addNewAttachment() {       

    BindingContainer bindings = getBindings();

    OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert1");

    operationBinding.execute();

    if (!operationBinding.getErrors().isEmpty()) {

        System.out.println("HasErrors");

        return null;

    }

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

    DCIteratorBinding Binding = iter.findIteratorBinding("AttachmentIterator");

    ViewObject vo = Binding.getViewObject();

    Row row = vo.getCurrentRow();

    String id = "123";

    row.setAttribute("EmpoyeeId", id);

   row.setAttribute("ProcessId", id);

    row.setAttribute("FileDesc", "File Description ");

    return null;      

}

--------------------------------------------------------or---------------------------------------------------------------

public String addNewAttachment() {           

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

    DCIteratorBinding Binding = iter.findIteratorBinding("AttachmentIterator");

    ViewObject vo = Binding.getViewObject();

    Row row = vo.createRow();

    String id = "123";

    row.setAttribute("EmpoyeeId", id);

    row.setAttribute("FileDesc", "File Description ");

    vo.insertRow(row);      

    return null;      

}

-----------------------------------------------------------------------------------------------------------------

when i click on button error message occour File_path is required. i want to set some of field from the method and set some filed like file_path from the view after add button is pressed

when click on button row is add to table but required field error displays. i am setting some required fields from the mehtod and want to set FilePath value form the view. this required message should not display how to handle it.

Error.png

This post has been answered by User_9PGVK on Apr 4 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2016
Added on Apr 4 2016
5 comments
277 views