/** * Builds a hidden input field * * @param key the name of the field * @param value the value for the field * @return */ public HtmlInput buildHiddenInput(String key, String value) { HtmlInput input = new HtmlInput(); input.setName(key); input.setType("hidden"); input.setValue(value); return input; }
/** * @param theme * @param name * @param id * @param value * @param size < 1 wont include size in the html * @param maxLength < 1 wont include maxLength in the html * @param inputType - text, password, ... * @param disabled if true the input is disabled. * @return */ public static HtmlInput buildInput( Theme theme, String name, String id, String value, int size, int maxLength, String inputType, boolean disabled) { HtmlInput input = new HtmlInput(); input.setClazz(theme.getValue(ThemeConst.INPUT_TEXT.toString())); input.setName(id); input.setId(id); input.setType(inputType); input.setValue(value); if (size > 0) { input.setSize("" + size); } if (maxLength > 0) { input.setMaxlength("" + maxLength); } if (disabled == true) { // input.setDisabled("disabled"); input.setReadonly("true"); } // return "<input " + theme.getTheme(ThemeConst.INPUT_TEXT.toString()) + " name=\"" + id + "\" // id=\"" + id // + "\" type=\"" + inputType + "\" value=\"" + value + "\"" + (size > 0 ? " size=\"" + size + // "\"" : "") // + (maxLength > 0 ? " maxlength=\"" + maxLength + "\"" : "") // + (disabled == true ? "disabled=\"disabled\"" : "") + "/>"; return input; }