wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/formsandinputs/Form.java
public String getNameBasedJsObject(
            final Collection<String> onlyForTagNames) {

        // "{" should not be changed to '{'
        final StringBuilder jsObjectBuilder = new StringBuilder("{");
        final Set<String> appendedValues = new HashSet<>();

        loopThroughAllNestedChildren(child -> {

            final String tagName = child.getTagName();

            if (onlyForTagNames.contains(tagName)) {

                final AbstractAttribute nameAttr = child
                        .getAttributeByName(AttributeNameConstants.NAME);
                final AbstractAttribute typeAttr = child
                        .getAttributeByName(AttributeNameConstants.TYPE);

                if (nameAttr != null) {
                    final String nameAttrValue = nameAttr.getAttributeValue();

                    if (!appendedValues.contains(nameAttrValue)) {

                        if (typeAttr != null) {
                            final String typeAttrValue = typeAttr
                                    .getAttributeValue();
                            if (Type.CHECKBOX.equals(typeAttrValue)
                                    || Type.RADIO.equals(typeAttrValue)) {
                                jsObjectBuilder.append(nameAttrValue)
                                        .append(':').append(nameAttrValue)
                                        .append(".checked,");
                                appendedValues.add(nameAttrValue);

                            } else {
                                jsObjectBuilder.append(nameAttrValue)
                                        .append(':').append(nameAttrValue)
                                        .append(".value,");
                                appendedValues.add(nameAttrValue);

                            }
                        } else {
                            jsObjectBuilder.append(nameAttrValue).append(':')
                                    .append(nameAttrValue).append(".value,");
                            appendedValues.add(nameAttrValue);

                        }

                    }
                }

            }
            return true;
        }, false, this);

        return jsObjectBuilder.replace(jsObjectBuilder.length() - 1,
                jsObjectBuilder.length(), "}").toString();
    }
public String getNameBasedJsObject(
            final Collection<String> onlyForTagNames) {

        // "{" should not be changed to '{'
        final StringBuilder jsObjectBuilder = new StringBuilder("{");
        final Set<String> appendedValues = new HashSet<>();

        loopThroughAllNestedChildren(child -> {

            final String tagName = child.getTagName();

            if (onlyForTagNames.contains(tagName)) {

                final AbstractAttribute nameAttr = child
                        .getAttributeByName(AttributeNameConstants.NAME);
                final AbstractAttribute typeAttr = child
                        .getAttributeByName(AttributeNameConstants.TYPE);

                if (nameAttr != null) {
                    final String nameAttrValue = nameAttr.getAttributeValue();

                    if (!appendedValues.contains(nameAttrValue)) {

                        if (typeAttr != null) {
                            final String typeAttrValue = typeAttr
                                    .getAttributeValue();
                            if (Type.CHECKBOX.equals(typeAttrValue)
                                    || Type.RADIO.equals(typeAttrValue)) {
                                jsObjectBuilder.append(nameAttrValue)
                                        .append(':').append(nameAttrValue)
                                        .append(".checked,");
                                appendedValues.add(nameAttrValue);

                            } else {
                                jsObjectBuilder.append(nameAttrValue)
                                        .append(':').append(nameAttrValue)
                                        .append(".value,");
                                appendedValues.add(nameAttrValue);

                            }
                        } else {
                            jsObjectBuilder.append(nameAttrValue).append(':')
                                    .append(nameAttrValue).append(".value,");
                            appendedValues.add(nameAttrValue);

                        }

                    }
                }

            }
            return true;
        }, false, this);

        return jsObjectBuilder.replace(jsObjectBuilder.length() - 1,
                jsObjectBuilder.length(), "}").toString();
    }
prepares and gets the js object for the given tag names under this form
tag. This js object may be used to return in onsubmit attribute.

@param onlyForTagNames

TagNameConstants.INPUT,
TagNameConstants.TEXTAREA and
TagNameConstants.SELECT. Pass object of
{@code List}, {@code HashSet} based on the
number of elements in it.

@return the js object string for the given tag names. The returned js
string will be as {name1.name1.value} where name1 is the value of
name attribute of the field.
@since 2.1.8
@since 2.1.13 changed {@code Collection<Set> onlyForTagNames} to
{@code Collection<String> onlyForTagNames}.
@author WFF