AnsweredAssumed Answered

How to get share form value from different fields?

Question asked by sprincess on Mar 17, 2017
Latest reply on Mar 20, 2017 by afaust



In my share config custom form, I have defined a validation handler on the field by the javascript file custom-form-handler.js

            <js src="/js/custom-form-handler.js"/>


<field id="wfm:quantity1" label="Quantity1">
             <constraint type="MANDATORY" validation-handler="MyCustomNamespace.checkAmount" event="keyup"/>



if (typeof MyCustomNamespace == "undefined" || !MyCustomNamespace) {
    var MyCustomNamespace = {};


    function checkAmount(field, args, event, form, silent, message) {
    var valid = alert(field.value)

    return valid;

I can get the field (wfm:quantity1) by use "field.value" to retrive the form field value.


May I know how can I get the other form field value in my custom-form-handler.js?

As I know, the field parameter is referring to what field I defined in the share config custom form.


In my case, I want to get the other form field value to do calculation in the custom-form-handler.js,

something like calculation of the form field value of "wfm:quantity1" * "wfm:itemA"


May I know how can I achieve this?

In addition, how can I put the value into the other different form field?

something like: DOM.getElementbyId(fieldName).value= "wfm:quantity1" * "wfm:itemA"


Thanks for your kindly help, any feedbacks are appreciated.