cancel
Showing results for 
Search instead for 
Did you mean: 

onActionFormDialog parameter

robert_begin
Champ on-the-rise
Champ on-the-rise
How do I reference a parameter assigned on the onactionFormDialog from within the server side javascript ?

Here's my "share-custom-config.xml"


<!– Custom DocLibActions config section –>

<config evaluator="string-compare" condition="DocLibActions">
  <actions>
    <action id="my-document-new-publish" icon="publish" type="javascript" label="actions.mycompany.mynewpublish">
      <param name="function">onActionFormDialog</param>
      <param name="itemKind">action</param>
      <param name="itemId">my-newpublish-action</param>
      <param name="mode">create</param>
      <param name="destination">{node.nodeRef}</param>
      <param name="successMessage">message.mycompany.mynewpublish.success</param>
      <param name="failureMessage">message.mycompany.mynewpublish.failure</param>
    </action>
  </actions>

  <actionGroups>
    <actionGroup id="document-browse">
      <action index="366" id="my-document-new-publish" />
    </actionGroup>   
  </actionGroups>
</config>

<config evaluator="string-compare" condition="my-newpublish-action">
  <forms>
    <form>
      <field-visibility>          
        <show id="myTarget"/>
      </field-visibility>
      <appearance>
        <field id="myTarget" label="Choose destination">
          <control template="/org/alfresco/components/form/controls/selectone.ftl">
            <control-param name="options">0|Intranet,1|Public Site</control-param>
          </control>
        </field>
      </appearance>
    </form>
  </forms>
</config>


My "shared\classes\alfresco\extension\mynewpublish-context.xml"


?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
<bean id="my-newpublish-action" parent="script">
    <property name="scriptLocation">
        <bean class="org.alfresco.repo.jscript.ClasspathScriptLocation">
            <constructor-arg>
                <value>alfresco/extension/scripts/mynewpublish.js</value>
            </constructor-arg>
        </bean>
    </property>
</bean>
</beans>


So how do I reference the myTarget parameter from within my server-side javascript mynewpublish.js in order to get the expected 0 or 1 value ?

var ret = action.parameters["myTarget"];

does not work. Hard to find examples anywhere.
2 REPLIES 2

marcello_modica
Champ in-the-making
Champ in-the-making
I have the same problem

dab
Champ in-the-making
Champ in-the-making
Marcello and Robert:
As I suggested on an alternate version of this thread, the issue at https://issues.alfresco.com/jira/browse/ALF-15969 seems to suggest that it is not possible to accomplish what you and I wish. I suggest that you obtain a JIRA account and vote for the issue as I have done.
The issue does seem to have received some attention at Alfresco, but I can find no indication that there is a solution.