public static String makeLinkHiddenFormName( Map<String, Object> context, ModelFormField modelFormField) { ModelForm modelForm = modelFormField.getModelForm(); Integer itemIndex = (Integer) context.get("itemIndex"); String iterateId = ""; String formUniqueId = ""; String formName = (String) context.get("formName"); if (UtilValidate.isEmpty(formName)) { formName = modelForm.getName(); } if (UtilValidate.isNotEmpty(context.get("iterateId"))) { iterateId = (String) context.get("iterateId"); } if (UtilValidate.isNotEmpty(context.get("formUniqueId"))) { formUniqueId = (String) context.get("formUniqueId"); } if (itemIndex != null) { return formName + modelForm.getItemIndexSeparator() + itemIndex.intValue() + iterateId + formUniqueId + modelForm.getItemIndexSeparator() + modelFormField.getName(); } else { return formName + modelForm.getItemIndexSeparator() + modelFormField.getName(); } }
public static void makeHyperlinkByType( Appendable writer, String linkType, String linkStyle, String targetType, String target, Map<String, String> parameterMap, String description, String targetWindow, String confirmation, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); if ("hidden-form".equals(realLinkType)) { if (modelFormField != null && "multi".equals(modelFormField.getModelForm().getType())) { WidgetWorker.makeHiddenFormLinkAnchor( writer, linkStyle, description, confirmation, modelFormField, request, response, context); // this is a bit trickier, since we can't do a nested form we'll have to put the link to // submit the form in place, but put the actual form def elsewhere, ie after the big form is // closed Map<String, Object> wholeFormContext = UtilGenerics.checkMap(context.get("wholeFormContext")); Appendable postMultiFormWriter = wholeFormContext != null ? (Appendable) wholeFormContext.get("postMultiFormWriter") : null; if (postMultiFormWriter == null) { postMultiFormWriter = new StringWriter(); wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); } WidgetWorker.makeHiddenFormLinkForm( postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); } else { WidgetWorker.makeHiddenFormLinkForm( writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); WidgetWorker.makeHiddenFormLinkAnchor( writer, linkStyle, description, confirmation, modelFormField, request, response, context); } } else { WidgetWorker.makeHyperlinkString( writer, linkStyle, targetType, target, parameterMap, description, confirmation, modelFormField, request, response, context, targetWindow); } }