Announcement Announcement Module
Collapse
No announcement yet.
Removing dynamically created items from AutopopulatingList Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Removing dynamically created items from AutopopulatingList

    I have created a simple form for editing user languages. Languages are implemented as AutoPopulatingList, and added dynamically in the jsp using jQuery. Addition works perfectly, but deletion unfortunately not. This is surprising, because when debugging requests I see that serialized form is stripped from removed items, say I start with three languages,
    Code:
    languages[0].code:pl
    languages[0].level:Fluent
    languages[1].code:de
    languages[1].level:Native
    languages[2].code:cc
    languages[2].level:Intermediate
    after removing the middle one POST request is as follows:
    Code:
    languages[0].code:pl
    languages[0].level:Fluent
    languages[2].code:cc
    languages[2].level:Intermediate
    but user model retrieved in update method,
    Code:
    @RequestMapping(value = "/user/{id}", method = RequestMethod.POST)
    @ResponseBody
    public String updateUser(@PathVariable("id") int id, @ModelAttribute("user") User user, HttpServletRequest request) {
        userService.update(user);
        return messageSource.getMessage("user.data_updated", null, request.getLocale());
    }
    still has three language elements, valid (not nulls, as I would expect in case of deleted items).
    I am banging my head agains the wall for quite some time, and I haven't figured out what may be wrong... Any help would be appreciated.
    I am using spring 3.1.1 and jQuery 1.7.2 if that's relevant.

  • #2
    Any ideas?

    Comment


    • #3
      Originally posted by tboloo View Post
      Any ideas?
      I guess your request should look like this:


      Code:
      languages[0].code:pl
      languages[0].level:Fluent
      languages[1].code:cc
      languages[1].level:Intermediate

      Comment

      Working...
      X