Bug 16066 - JavaScript error on new patron form when duplicate is suspected
Summary: JavaScript error on new patron form when duplicate is suspected
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL: /cgi-bin/koha/members/memberentry.pl
Keywords:
Depends on: 15206 16065
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-14 15:22 UTC by Owen Leonard
Modified: 2016-12-05 21:23 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 16066 - JavaScript error on new patron form when duplicate is suspected (3.27 KB, patch)
2016-03-14 16:05 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 16066 - JavaScript error on new patron form when duplicate is suspected (3.45 KB, patch)
2016-03-14 16:10 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 16066 - JavaScript error on new patron form when duplicate is suspected (3.53 KB, patch)
2016-03-15 15:11 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2016-03-14 15:22:44 UTC
JavaScript on the patron add/edit form uses "document.form" to find the value of a form field on the page:

var age = CalculateAge(document.form.dateofbirth.value);

If you have tried to save a patron which is suspected to be a duplicate, the template defines the <form> without a name attribute and thus the value of dateofbirth cannot be found.
Comment 1 Owen Leonard 2016-03-14 16:05:14 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2016-03-14 16:10:41 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2016-03-15 15:11:43 UTC
Created attachment 49175 [details] [review]
Bug 16066 - JavaScript error on new patron form when duplicate is suspected

When a new patron is submitted which is suspected to be a duplicate, the
entry form is redisplayed with a new name attribute, "form_nodouble."
Other scripts on the page still look for a form named "form," so there
is an error.

This patch removes the use of "form_nodouble" on the assumption that it
is unnecessary to name the form something different when a duplicate is
suspected. All the same validation scripts should be run on the form
either way.

To test, apply the patch and clear your cache if necessary.

- Go to Patrons -> New patron and add a patron which matches an existing
  one in order to trigger the duplicate warning.
- Confirm that Firebug (or similar) is not reporting a JavaScript error.
- Confirm that the 'Edit existing' and 'Save as new' buttons work
  correctly.

Reproduced JavaScript error and verified that it no longer appears with
this patch.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Jonathan Druart 2016-03-15 15:12:11 UTC
JS error caused by bug 15206.
Comment 5 Brendan Gallagher 2016-03-21 21:34:24 UTC
Pushed to Master - Should be in the May 2016 release.  Thanks!
Comment 6 Julian Maurice 2016-03-23 08:53:44 UTC
Does not concern stable versions, status changed to RESOLVED