Bugzilla – Attachment 8191 Details for
Bug 7670
make required fields red in additem.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7670 - make required fields red
Bug-7670---make-required-fields-red.patch (text/plain), 4.51 KB, created by
Liz Rea
on 2012-03-12 20:23:31 UTC
(
hide
)
Description:
Bug 7670 - make required fields red
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2012-03-12 20:23:31 UTC
Size:
4.51 KB
patch
obsolete
>From d7366561c4962ccddea4b45554fa0b9103a6f787 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 8 Mar 2012 08:53:45 -0500 >Subject: [PATCH] Bug 7670 - make required fields red >Content-Type: text/plain; charset="utf-8" > >Adding "required" style and "Required" note to additem fields, >consistent with the way required fields are displayed >on the add patron form. > >This patch also corrects an error in the client-side validation >script which misidentified which fields were required. Leaving >a required field empty should result in an alert and the missing >field being highlighted in yellow. > >To test, open the add item form on a record which uses >a framework in which one or more item fields are required. >Required fields should be labeled in red and appended with a >"Required" note. > >Submit the form while some required fields are empty. You should >see a javascript alert. The empty mandatory fields should have >a yellow background. > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >Works - passes tests. >--- > .../intranet-tmpl/prog/en/css/staff-global.css | 1 + > .../prog/en/modules/cataloguing/additem.tt | 30 ++++++++++--------- > 2 files changed, 17 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >index fec66d6..e3120a3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >@@ -1290,6 +1290,7 @@ div.note { > > span.required { > font-style : italic; >+ margin-left : .5em; > } > > .term { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >index 91c2d48..008af82 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -34,25 +34,24 @@ function active(numlayer) > } > } > function Check(f) { >- > var total_errors=0; >-// alert(f.field_value.length); >- for (i=0 ; i<f.field_value.length ; i++) { >-// alert (f.field_value[i].value); >- if (f.field_value[i].value.length==0 && f.mandatory[i].value==1) { >- document.getElementById("error"+i).style.backgroundColor="#FF0000"; >- total_errors++; >- } else { >-// document.getElementById("error"+i).style.backgroundColor="#FFFFFF"; >+ $("input[name='mandatory'],select[name='mandatory']").each(function(i){ >+ if($(this).val() == 1){ >+ var mandatory_field = $("input[name='field_value'],select[name='field_value']").eq(i); >+ if(mandatory_field.val() == ''){ >+ mandatory_field.css("background-color","#FFFFCC"); >+ total_errors++; >+ } > } >- } >+ }); >+ > var alertString2; > if (total_errors==0) { > return true; > } else { > alertString2 = _("Form not submitted because of the following problem(s)"); > alertString2 += "\n------------------------------------------------------------------------------------\n"; >- alertString2 += "\n- "+ total_errors+_(" mandatory fields empty (see bold subfields)"); >+ alertString2 += "\n- "+ total_errors+_(" mandatory fields empty (highlighted)"); > alert(alertString2); > return false; > } >@@ -237,8 +236,11 @@ function set_to_today(id, force) { > <ol> > [% FOREACH ite IN item %] > <li><div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]"> >- >- <label>[% ite.subfield %] - [% IF ( ite.mandatory ) %]<b>[% END %][% ite.marc_lib %][% IF ( ite.mandatory ) %] *</b>[% END %]</label> >+ [% IF ( ite.mandatory ) %] >+ <label class="required">[% ite.subfield %] - [% ite.marc_lib %]</label> >+ [% ELSE %] >+ <label>[% ite.subfield %] - [% ite.marc_lib %]</label> >+ [% END %] > [% ite.marc_value %] > <input type="hidden" name="tag" value="[% ite.tag %]" /> > <input type="hidden" name="subfield" value="[% ite.subfield %]" /> >@@ -246,7 +248,7 @@ function set_to_today(id, force) { > [% IF ( ite.repeatable ) %] > <span class="buttonPlus" onclick="CloneSubfield('subfield[% ite.tag %][% ite.subfield %][% ite.random %]')">+</span> > [% END %] >- >+ [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %] > </div></li> > [% END %] > </ol> >-- >1.7.2.5
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 7670
:
8088
|
8093
|
8190
| 8191 |
8247