From 8c5278270708724808b3585dc798e9300abeed31 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 10 Sep 2013 17:19:10 +0200 Subject: [PATCH] Bug 5031: CSV profiles: validate required content fields Some fields are required on editing/adding CSV profiles. This patch adds HTML5 validation so that required fields must be filled in before the form is submitted. Test plan: - add a new CSV profile (tools/csv-profiles.pl) without any value. - save => error on empty fields. - fill the "marc" content, select type="sql", fill the CSV name input. - save => error on sql content field. - fill the sql content - save => the CSV profile is saved. - retry for the edit form. Signed-off-by: Bernardo Gonzalez Kriegel Comment: On top of both patches for Bug 10853 Works very well, now we get an alert with empty field Saves correctly MARC and SQL profiles Solved minor conflict introduced by tab followup on Bug 10853 Again small tab errors corrected in followup Signed-off-by: Katrin Fischer Works as described, looks a bit 'non standard' for Koha, but improves usability of the form. Signed-off-by: Galen Charlton --- .../prog/en/modules/tools/csv-profiles.tt | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt index e2a299c0c8..c556e15324 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt @@ -15,21 +15,30 @@ function reloadPage(p) { $("#profile_type").change(function(){ if ( $(this).find("option:selected").val() == "marc" ) { $("#csvnew li.marc_specific").show(); + $("#new_profile_marc_content").attr("required", "required"); $("#csvnew li.sql_specific").hide(); + $("#new_profile_sql_content").removeAttr("required"); } else { $("#csvnew li.marc_specific").hide(); + $("#new_profile_marc_content").removeAttr("required"); $("#csvnew li.sql_specific").show(); + $("#new_profile_sql_content").attr("required", "required"); } }); $("#modify_profile_type").change(function(){ if ( $(this).find("option:selected").val() == "marc" ) { $("#csvedit li.marc_specific").show(); + $("#modify_profile_marc_content").attr("required", "required"); $("#csvedit li.sql_specific").hide(); + $("#modify_profile_sql_content").removeAttr("required"); } else { $("#csvedit li.marc_specific").hide(); + $("#modify_profile_marc_content").removeAttr("required"); $("#csvedit li.sql_specific").show(); + $("#modify_profile_sql_content").attr("required", "required"); } }); + $("#profile_type").change(); $("#modify_profile_type").change(); }); //]]> @@ -79,7 +88,7 @@ function reloadPage(p) {
  1. -
  2. +
  3. @@ -143,14 +152,14 @@ function reloadPage(p) {
  4. -
  5. - +
  6. +

    You have to define which fields or subfields you want to export, separated by pipes.

    You can also use your own headers (instead of the ones from Koha) by prefixing the field number with an header, followed by the equal sign.

    Example: Personal name=200|Entry element=210$a|300|009

  7. - +

    You have to define which fields you want to export, separated by pipes.

    You can also use your own headers (instead of the ones from Koha) by prefixing the field name with an header, followed by the equal sign.

    @@ -170,7 +179,7 @@ function reloadPage(p) {
      -
    1. +
    2. - +
    3. -
    4. -
    5. +
    6. +
    7. - +
    8. -- 2.39.5