diff --git a/webapp/config/tlds/vitroForm.tld b/webapp/config/tlds/vitroForm.tld index 0674bdedd..cbde329b5 100644 --- a/webapp/config/tlds/vitroForm.tld +++ b/webapp/config/tlds/vitroForm.tld @@ -141,7 +141,12 @@ id true true - + + + name + false + true + label false diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java index 28f7a7232..dce7d89b8 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java @@ -54,6 +54,8 @@ import edu.cornell.mannlib.vitro.webapp.utils.StringUtils; */ public class InputElementFormattingTag extends TagSupport { private String id; + // NB name is optional. If not specified, the name comes from the id value. + private String name; private String type; private String label; private String cancelLabel; @@ -78,6 +80,13 @@ public class InputElementFormattingTag extends TagSupport { this.id = idStr; } + public String getName() { + return StringUtils.isEmpty(name) ? id : name; + } + public void setName(String name) { + this.name = name; + } + public String getType() { return type; } @@ -420,7 +429,7 @@ public class InputElementFormattingTag extends TagSupport { String valueStr = doValue(editConfig, editSub); String sizeStr = doSize(); if (definitionTags) { out.print("
"); } - out.print(""); + out.print(""); if (definitionTags) { out.print("
"); } out.println(); } else if (getType().equalsIgnoreCase("textarea")) { @@ -428,22 +437,22 @@ public class InputElementFormattingTag extends TagSupport { String rowStr = doRows(); String colStr = doCols(); if (definitionTags) { out.print("
"); } - out.print(""); + out.print(""); if (definitionTags) { out.print("
"); } out.println(); } else if( getType().equalsIgnoreCase("select")) { String valueStr = doValue(editConfig, editSub); //String sizeStr = getSize(); //"style=\"width:"+getSize()+"%;\""; - Map optionsMap = SelectListGenerator.getOptions(editConfig,getId(), wdf); + Map optionsMap = SelectListGenerator.getOptions(editConfig,getName(), wdf); if (optionsMap==null){ log.error("Error in InputElementFormattingTag.doStartTag(): null optionsMap returned from getOptions()"); } if (optionsMap.size()>0) { // e.g., an Educational Background where may be no choices left after remove existing if (definitionTags) { out.print("
"); } if (multiple!=null && !multiple.equals("")) { - out.print(" 10? "10" : optionsMap.size())+"\">"); } else { - out.print(""); } optionsMap = getSortedMap(optionsMap); Iterator iter = optionsMap.keySet().iterator(); @@ -459,12 +468,12 @@ public class InputElementFormattingTag extends TagSupport { out.print(""); if (definitionTags) { out.print("
"); } } else { - out.println("

no appropriate choice available

"); + out.println("

no appropriate choice available

"); } } else if( getType().equalsIgnoreCase("checkbox")) { String valueStr = doValue(editConfig, editSub); if (definitionTags) { out.print("
"); } - Map optionsMap = SelectListGenerator.getOptions(editConfig,getId(),wdf); + Map optionsMap = SelectListGenerator.getOptions(editConfig,getName(),wdf); if (optionsMap==null){ log.error("Error in InputElementFormattingTag.doStartTag(): null optionsMap returned from getOptions()"); } @@ -473,7 +482,7 @@ public class InputElementFormattingTag extends TagSupport { while (iter.hasNext()) { String key = (String) iter.next(); String mapValue = optionsMap.get(key); - out.print(""); } - Map optionsMap = SelectListGenerator.getOptions(editConfig,getId(),wdf); + Map optionsMap = SelectListGenerator.getOptions(editConfig,getName(),wdf); if (optionsMap==null){ log.error("Error in InputElementFormattingTag.doStartTag(): null optionsMap returned from getOptions()"); } @@ -492,7 +501,7 @@ public class InputElementFormattingTag extends TagSupport { while (iter.hasNext()) { String key = (String) iter.next(); String mapValue = optionsMap.get(key); - out.print(""); } } else if( getType().equalsIgnoreCase("file")) { - String fieldName = getId(); + String fieldName = getName(); if( editConfig.getUrisInScope().containsKey(fieldName) ){ //if there is a link to a file Individual then this is //a update and we should just disable the control out.println(""); } else { if(definitionTags) {out.print("
");} - out.print(""); + out.print(""); if(definitionTags) {out.print("
");} out.print("\n"); } @@ -530,7 +539,7 @@ public class InputElementFormattingTag extends TagSupport { } if (optionsMap.size()>0) { if (definitionTags) { out.print("
"); } - out.print(""); optionsMap = getSortedMap(optionsMap); Iterator iter = optionsMap.keySet().iterator(); while (iter.hasNext()) {