Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure form submission is complete with fields in DataTables #795

Merged
merged 2 commits into from
Oct 6, 2016

Conversation

seav
Copy link
Contributor

@seav seav commented Oct 6, 2016

Proposed changes in this pull request

  • Fix Server error when adding a new member in the org that has more than one page list of projecs #782 and Adding a project cannot complete if there are many org members #796 and improve fix for Adding resources not on page 1 of library broken #507:
    • Overview: When a form has fields inside DataTables, these fields may become detached from the form and not submitted with the form because DataTables hides rows due to its search/filter/paging functionality. This may result in errors because the server expects complete fields to be submitted with the form.
    • Create activateFormFieldsInDataTable() JS function inside a new static JS file dataTables.forms.js. This function activates the selected form DataTable form fields such that hidden form fields are submitted with the form.
    • Call activateFormFieldsInDataTable() from the following templates:
      • organization/organization_members_edit.html
      • organization/project_add_permissions.html
      • organization/project_edit_permissions.html
      • party/relationship_resources_add.html (via script_add_lib.html)
      • party/resources_add.html (via script_add_lib.html)
      • resources/project_add_existing.html (via script_add_lib.html)
      • spatial/resources_add.html (via script_add_lib.html)
    • Update script_add_lib.html to call activateFormFieldsInDataTable().

When should this PR be merged

Before Sprint 9 release.

Risks

None foreseen.

Follow up actions

None.

@ian-ross
Copy link
Contributor

ian-ross commented Oct 6, 2016

Do you think you could use the same approach to fix #507 and #796? If so, could you add fixes for those to this PR and refactor the JS so it can be shared among all pages with this "inputs in datatables" problem? We're likely to get a cleaner solution if you fix them all at the same time, and we're also less likely to forget that you've already done this for one of these things. (And you'd close three issues with one PR, which is always satisfying!)

@seav
Copy link
Contributor Author

seav commented Oct 6, 2016

@ian-ross, sure. I guessed that somebody will eventually suggest to combine the JS so that it can apply to all DataTables in HTML forms.

@seav seav changed the title Fix #782: Avoid error on org member edit page Ensure form submission is complete with fields in DataTables Oct 6, 2016
@seav
Copy link
Contributor Author

seav commented Oct 6, 2016

@ian-ross: I've updated the PR to generalize the solution. Please refer to the updated PR comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server error when adding a new member in the org that has more than one page list of projecs
2 participants