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.
