Bugzilla – Attachment 68503 Details for
Bug 10267
No error message when entering an invalid cardnumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10267: Display the message only if the user enters too many characters
Bug-10267-Display-the-message-only-if-the-user-ent.patch (text/plain), 2.25 KB, created by
Jonathan Druart
on 2017-10-24 21:13:06 UTC
(
hide
)
Description:
Bug 10267: Display the message only if the user enters too many characters
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-10-24 21:13:06 UTC
Size:
2.25 KB
patch
obsolete
>From 110e9da5f99070a409f6d4118bfb6961945ef3aa Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 24 Oct 2017 18:10:40 -0300 >Subject: [PATCH] Bug 10267: Display the message only if the user enters too > many characters > >It seems better to display the warning if the user tries to enter too >many characters in the input. > >Test plan: >With max=16 >1. Copy/paste a string with 15, 16 and 17 characters >2. Enter a cardnumber of 15, 16, 17 characters >The warning should be displayed only the input overflows >--- > .../prog/en/modules/members/memberentrygen.tt | 29 ++++++++++++++++------ > 1 file changed, 22 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 68dafdaf2c..5ba4122c95 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -35,16 +35,31 @@ $(document).ready(function() { > [% END %] > }); > >+function update_cardnumber_warning(size){ >+ var max_len = [% maxlength_cardnumber %]; >+ if ( size >= max_len ) { >+ $("#cn_max").show(); >+ } else { >+ $("#cn_max").hide(); >+ } >+} >+ > $(document).ready(function() { > $("#cn_max").hide(); >- var max_len = [% maxlength_cardnumber %]; >- $("#cardnumber").change(function(){ >- if ( $("#cardnumber").val().length >= max_len ) { >- $("#cn_max").show(); >- } else { >- $("#cn_max").hide(); >- } >+ var content; >+ $("#cardnumber").on("keydown", function(e){ >+ content = $(this).val(); >+ }); >+ $("#cardnumber").on("keyup", function(e){ >+ // .val() will return the value of the input after the key has been released >+ var l = $(this).val().length; >+ if ( l == content.length + 1 ) { l--; } >+ update_cardnumber_warning(l); > }); >+ $("#cardnumber").bind("paste", function(e){ >+ var pastedData = e.originalEvent.clipboardData.getData('text'); >+ update_cardnumber_warning(pastedData.length - 1); >+ } ); > var toggle_quick_add = $(".toggle_quick_add"); > $(toggle_quick_add).click(function(e){ > toggle_quick_add.toggle(); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10267
:
62440
|
62442
|
62806
|
62934
|
65657
|
66732
|
68503
|
68504
|
68724
|
68725