Currently the patron entry template has a lot of logic handling form fields when the operation being performed is "duplicate:" [% IF ( opduplicate ) %] <input type="text" name="altcontactphone" id="altcontactphone" value="[% altcontactphone %]" onclick="this.value=''" /> [% ELSE %] <input type="text" name="altcontactphone" id="altcontactphone" value="[% altcontactphone %]" /> [% END %] I propose to set a class on fields which require this behavior so that the event can be handled in the script block.
Created attachment 20503 [details] [review] Bug 10769 - Simplify clearing of input fields when duplicating a patron When duplicating a patron record an onclick event is added to many fields in order to make then clear when focused. This patch updates the template so that the logic for this can be simplified. A template variable is set based on the 'opduplicate' variable, and a class added to the relevant fields. All fields with that class are cleared on focus. Also changed are several markup issues which were causing validation errors. To test, find or create a patron record which has all standard text fields filled with data. Use the "duplicate" button on the detail view of that patron to initiate the duplication process. Focus on each field in the patron entry form in succession. Fields which contain data should be cleared in the same way they were before the patch. Also test a regular edit operation to confirm that fields are not cleared.
Created attachment 20683 [details] [review] Signed Off: Bug 10769 - Simplify clearing of input fields when duplicating a patron
Created attachment 20735 [details] [review] Bug 10769 - Simplify clearing of input fields when duplicating a patron When duplicating a patron record an onclick event is added to many fields in order to make then clear when focused. This patch updates the template so that the logic for this can be simplified. A template variable is set based on the 'opduplicate' variable, and a class added to the relevant fields. All fields with that class are cleared on focus. Also changed are several markup issues which were causing validation errors. To test, find or create a patron record which has all standard text fields filled with data. Use the "duplicate" button on the detail view of that patron to initiate the duplication process. Focus on each field in the patron entry form in succession. Fields which contain data should be cleared in the same way they were before the patch. Also test a regular edit operation to confirm that fields are not cleared. Signed-off-by: Campbell Reid-Tait <campbellreidtait@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Passes koha-qa.pl, works as advertised.
Pushed to master. Thanks, Owen!