AnsweredAssumed Answered

Share Action Form with Hidden Fields

Question asked by eamell on May 2, 2013
Latest reply on May 2, 2013 by eamell
I have an Alfresco server side action and I have a Share action associated with it.  There are 4 parameters to the action; 2 required and 2 optional.  Instead of showing the fields and letting the user enter them I am doing a database query and displaying a table that will allow the user to select a row.  I have a custom control that renders the table and one of the two required fields.  I then have hidden fields for the other three fields.  The selection of the row works fine and populates the values of the hidden fields correctly.  However the submit (OK) button doesn't get enabled.  After digging for a while I have found that no events are triggered when the value of the hidden field is set in JavaScript.

I don't consider myself a JavaScript programmer and was sort of hoping there was an easy solution.

The following is how I am setting the value of the fields (the method is called each time … localThis is used to work around scoping rules in object oriented JavaScript):

<javascript>
    function setHiddenFieldValue(fieldName, fieldValue) {
        var field = YAHOO.util.Dom.get(localThis.fieldNamePrefix + fieldName);
        field.value = fieldValue;
    }
</javascript>

The following is a sanitized version of my form from my share custom config:


    <config evaluator="string-compare" condition="fn-create-some-folder">
        <forms>
            <form>
                <field-visibility>
                    <show id="someNumber" />
                    <show id="someType" />
                    <show id="someName" />
                    <show id="someTypeDesc" />
                </field-visibility>
                <appearance>
                    <field id="someNumber" label-id="label.create-some.available_some_list">
                        <control template="/org/alfresco/components/form/controls/createSomething.ftl">
                            <control-param name="parentNodeRef">{node.nodeRef}</control-param>
                        </control>
                    </field>
                    <field id="someType">
                        <control template="/org/alfresco/components/form/controls/hiddenFieldWithId.ftl" />
                    </field>
                    <field id="someName">
                        <control template="/org/alfresco/components/form/controls/hiddenFieldWithId.ftl" />
                    </field>
                    <field id="someTypeDesc">
                        <control template="/org/alfresco/components/form/controls/hiddenFieldWithId.ftl" />
                    </field>
                </appearance>
            </form>
        </forms>
    </config>


hiddenFieldWithId.ftl is nearly identical to hidden.ftl except that I actually set the ID of the hidden field to make it easier to get.

Outcomes