/** * Returns label string for a field of the underline object. * * <p>This method should not be used without using <tt>formFor</tt> method first. * * <pre> * Examples: * <label for="post_name" >Name</label> * <div class="fieldWithErrors"><label for="post_title" >Title</label></div><br /> * </pre> * * @param field field name * @param options options for the label tag * @return error-aware label tag string */ public static String label(String field, Map options) { if (options == null) options = new HashMap(); Object object = getObjectFromCurrentCache(); Object objectKey = getObjectKeyFromCurrentCache(); options.put("for", tagId(objectKey, field)); return W.taggedContent(object, field, "label", WordUtil.titleize(field), options); }