AnsweredAssumed Answered

How to access form fields value in a control component ?

Question asked by stondini on Apr 4, 2014
Latest reply on Apr 14, 2014 by aaditvmajmudar
Hello,

I have a form with many fields and a custom javascript object-finder for an association (this object is a subclass of Alfresco.ObjectFinder).

Here the share-config-custom.xml :.
<code>
<appearance>
   <field id=“xyz:textField" mandatory=“true" />
   <field id=“xyz:assocField" mandatory="true">
      <control template=“/xyz/components/form/controls/searchPicker.ftl">
         <control-param name="showTargetLink">true</control-param>
         <control-param name="name="linkedField""> xyz:textField </control-param>
      </control>
   </field>
</appearance>
<code>

The user fills the first field in and when it clicks on the button “select” of the association field,
a custom selection box appears and I’d like to use the value of the first field in it.

In fact, I’d like to have access to the entier form fields in my custom control.
I tried to use something like this :
<code>
var form = new Alfresco.forms.Form(this.objectFinder.formHtmlId);
form.init();
var fields = form.getDataFields();
<code>
But the current association value is not present (other fields are present).

Everything is on the client side, no server access because the form fields are not save when user fills them in.

Do you have some advices or examples ?

Thank you.

Outcomes