<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to get share form value from different fields? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-share-form-value-from-different-fields/m-p/19548#M8636</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my share config custom form, I have defined a validation handler on the field by the javascript file &lt;STRONG&gt;custom-form-handler.js&lt;/STRONG&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;lt;config&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;forms&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dependencies&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp; &amp;lt;js src="/js/custom-form-handler.js"/&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dependencies&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/forms&amp;gt;&lt;BR /&gt;&amp;lt;/config&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;field id="wfm:quantity1" label="Quantity1"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;constraint-handlers&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt; &amp;lt;constraint type="MANDATORY" validation-handler="MyCustomNamespace.checkAmount" event="keyup"/&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;lt;/constraint-handlers&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/field&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;custom-form-handler.js&lt;/STRONG&gt;:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;if (typeof MyCustomNamespace == "undefined" || !MyCustomNamespace) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var MyCustomNamespace = {};&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MyCustomNamespace.checkAmount=&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function checkAmount(field, args, event, form, silent, message) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var valid = alert(field.value)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return valid;&lt;BR /&gt;}&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I can get the field (wfm:quantity1) by use "field.value" to retrive the form field value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I know how can I get the other form field value in my &lt;STRONG&gt;custom-form-handler.js&lt;/STRONG&gt;?&lt;/P&gt;&lt;P&gt;As I know, the field parameter is referring to what field I defined in the share config custom form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my case, I want to get the other form field value to do calculation in the &lt;STRONG&gt;custom-form-handler.js&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;something like calculation of the form field value of &lt;STRONG&gt;"wfm:quantity1" * "wfm:itemA"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I know how can I achieve this?&lt;/P&gt;&lt;P&gt;In addition, how can I put the value into the other different form field?&lt;/P&gt;&lt;P&gt;something like: &lt;STRONG&gt;DOM.getElementbyId(fieldName).value= "wfm:quantity1" * "wfm:itemA"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your kindly help, any feedbacks are appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Mandy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Mar 2017 15:33:30 GMT</pubDate>
    <dc:creator>sprincess</dc:creator>
    <dc:date>2017-03-17T15:33:30Z</dc:date>
    <item>
      <title>How to get share form value from different fields?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-share-form-value-from-different-fields/m-p/19548#M8636</link>
      <description>Hello, In my share config custom form, I have defined a validation handler on the field by the javascript file custom-form-handler.js&amp;lt;config&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;forms&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dependencies&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;js src="/js/custom-form-handler.js"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dependencies&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/forms&amp;gt;&amp;lt;/</description>
      <pubDate>Fri, 17 Mar 2017 15:33:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-share-form-value-from-different-fields/m-p/19548#M8636</guid>
      <dc:creator>sprincess</dc:creator>
      <dc:date>2017-03-17T15:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get share form value from different fields?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-share-form-value-from-different-fields/m-p/19549#M8637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The validators in Share forms are always only "field" validators. They are not actually designed to validate values of multiple fields in conjunction. About the only thing you could do is try and lookup any other fields from the "form" parameter that is provided to you. This ultimately means you'd have to come up with some form of name convention to identify related fields or resort to hard-coding of field names in the JS code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Mar 2017 15:04:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-share-form-value-from-different-fields/m-p/19549#M8637</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-03-19T15:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get share form value from different fields?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-share-form-value-from-different-fields/m-p/19550#M8638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Axel for the response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, I'm quite new on the share form customization....&lt;/P&gt;&lt;P&gt;From "form" parameter, it seems I could not find any other fields information, something I found was near to the result but just the event name "&lt;SPAN class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; color: #881391; flex-shrink: 0; font-family: Consolas, 'Lucida Console', 'Courier New', monospace; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: nowrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"&gt;_fieldEvents&lt;/SPAN&gt;&lt;SPAN class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; flex-shrink: 0; padding-right: 5px; color: #212121; font-family: Consolas, 'Lucida Console', 'Courier New', monospace; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: nowrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; position: relative; vertical-align: baseline; color: #212121; display: inline-block; font-family: Consolas, 'Lucida Console', 'Courier New', monospace; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: nowrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"&gt;Object&lt;/SPAN&gt;".&lt;/P&gt;&lt;P&gt;May I know how could I lookup the other fields from the "form" parameter? Let's assume I have a defined field in share-config-custom.xml called "wfm:itemA".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, I would like to know more detail on how to identify related field by name convention or hard-coding of field names?&lt;/P&gt;&lt;P&gt;Is it meaning to change the field name from:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="min-width: 0px; min-height: 0px; box-sizing: border-box;"&gt;field = &lt;SPAN class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; position: relative; vertical-align: baseline; color: #881280; display: inline-block;"&gt;&lt;SPAN class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; color: #881280;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; color: #1a1aa6; unicode-bidi: -webkit-isolate;"&gt;#template_x002e_start-workflow_x002e_start-workflow_x0023_default-startWorkflowForm-alf-id1_prop_wfm_quantity1&lt;/SPAN&gt;&lt;SPAN class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; color: #994500; unicode-bidi: -webkit-isolate;"&gt;.number.invalid&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="min-width: 0px; min-height: 0px; box-sizing: border-box;"&gt;to something like&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="min-width: 0px; min-height: 0px; box-sizing: border-box;"&gt; shareFormFieldCustom_prop_wfm_quantity1?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; position: relative;"&gt; &lt;/DIV&gt;&lt;DIV class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; position: relative;"&gt;Sorry for my poor understanding,&lt;/DIV&gt;&lt;DIV class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; position: relative;"&gt;thanks for your kindly advise!&lt;/DIV&gt;&lt;DIV class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; position: relative;"&gt; &lt;/DIV&gt;&lt;DIV class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; position: relative;"&gt;BR,&lt;/DIV&gt;&lt;DIV class="" style="min-width: 0px; min-height: 0px; box-sizing: border-box; position: relative;"&gt;Mandy&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Mar 2017 18:49:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-share-form-value-from-different-fields/m-p/19550#M8638</guid>
      <dc:creator>sprincess</dc:creator>
      <dc:date>2017-03-19T18:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get share form value from different fields?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-share-form-value-from-different-fields/m-p/19551#M8639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The "form" parameter provided to the validator function is an instance of "Alfresco.forms.Form" (YUI module). This contains a "formId" property that you can use to retrieve the DOM element for the form. Via the DOM API you can iterate over all form input elements and check the name of the elements without having to resolve it by ID. Since you get the current field as the "field" parameter you can use its name to come up with a convention of which other fields should be relevant for a specific validation. E.g. you have a "xyz_aaaToSubtract" and a "xyz_aaaBase" field, you could add a generic validator to check that the "*ToSubtract" field is always less-or-equal the "*Base" field by focussing on the field suffix and extracting the common base name.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Mar 2017 12:30:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-share-form-value-from-different-fields/m-p/19551#M8639</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-03-20T12:30:02Z</dc:date>
    </item>
  </channel>
</rss>

