Announcement Announcement Module
No announcement yet.
Having add and edit functionalities in same page using SimpleFormController Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Having add and edit functionalities in same page using SimpleFormController

    Hi All,

    I am successful in implementing Add and Listing functionality using SimpleFormController.

    Now i want to have both Add and Edit functionality in same page.
    So on click of customer name in listing page, i am calling one javascript method and adding customer id to hidden parameter and submitting the listing form with action "".

    Controller for this action is SimpleFormController and i am having formBackingObject method like this:

    protected Object formBackingObject(HttpServletRequest request) throws Exception
    CustomerGeneral customerGeneral = new CustomerGeneral();

    String custId = request.getParameter("customerId")!=null?request.g etParameter("customerId"):"";

    CrmCustomer crmCust = customerService.getCRMCustomer(custId);
    System.out.println("Inside formBackingBean of Customer Add :: " + custId);
    customerGeneral.setFirstName(crmCust.getIfwContact s().getFirstname());

    return customerGeneral;

    The problem is:

    When i have "" as a GET action (when i have a link with href="" and clicking the link), my add page comes without any validation done. But when i submit the list page with action "" as a POST method i will get my add page with validation done. So if i am not populating my "Last Name" filed to my command (as i did for firstname in formBackingObject method), i will get validation error message to the field.

    I tested with some sysouts in all my overrided methods (referenceData, formBackingObject, initBinder, onSubmit). Apart from onSubmit method all other sysouts are displaying.

    So i want to know what is the behavior of formBackingObject method. And how can i prevent for not validating my fields in this situation?

    Please help me!!!

  • #2
    You can override isFormSubmission which will tell the workflow to call formBackingObject or not.