0 votes

Hi!

In Action entity I created a field "FSBTYPE" (LK on LKACTI_SUBTYPE)
In the EditContext I want to define his selectables options according to the value of NATURE.

Associated fields works in conficy only with 2 customs fields, but NATURE is not one.

I try to to it and I have a problem :
in Conficy ==> Action form (edit) I defined :
- NATURE as LOOKUP
- F_SUBTYPE as ACTISUBTYPE

FormFieldsEditCustom.txt :

label.ACTISUBTYPE.Acti {[Sous-type]}
field.ACTISUBTYPE.Acti {[
  <%RunQuery(id="ActiSubtype", sql="SELECT * FROM <#TABLE NAME=LK_ACTI_SUBTYPE>")%>
  <select name="F_SUBTYPE" id="F_SUBTYPE" title="" data-placeholder="<%GetLabel('Select Value')%>..." <%IfReadOnly(then='disabled')%>>
              <option value="-1"></option>
              <%Delay(1)%>GetDataGrid(query="ActiSubtype", count=-1, TemplateText=|<#repeat>
                <option value='<#F=K_ACTI_SUBTYPE>' master='<#F=LK_ACTI_NATURE>' <#I=K_ACTI_SUBTYPE;<%GetField('NATURE')%>=selected='selected';#ELSE=>><#F=F_SUBTYPE></option>
              </#repeat>|
  )%>
  </select>
]}

MacroEditSCustom.txt :

function AfterLoaded() {
        // ...
        fctLinkMarsterDetail("NATURE", "F_SUBTYPE");
}

function fctLinkMarsterDetail(p_Master, p_Detail) {
      var $master = $("#"+p_Master);
      if ($master.length > 0) {
        $master.change(function() {
          fctUpdateDetail(p_Master, p_Detail, true);
        });
        fctUpdateDetail(p_Master, p_Detail, false);
      }
    }

    function fctUpdateDetail(pMaster, pDetail, pChange) {
      var $master = $("#"+pMaster);
      var $detail = $("#"+pDetail);
      var master = $master.val();

      if( master == "" || master == "0" ){
        $detail.select2('readonly', true).select2("val", "0");
      }
      else {
        if(pChange){
          $detail.select2("val", "0");
        }
        $detail.select2('readonly', false);                                           
        if ($detail.length > 0){
          $('#'+pDetail + ' > option').each(function() {
            if($(this).attr('master') != 0 && $(this).attr('master') != master) {
              $(this).attr('class','show-for-portrait');
            }
            else {
              $(this).attr('class','');
            }
          });
        }
      }
    }

My problem is that the field in Edit form looks like a number input:
enter image description here
Can anyone say me why Efficy ignore my Definition ?

asked in How to by (259 points)

1 Answer

0 votes

The definition should not be ignored. Try to isolate the issue.

  1. Remove everything from FormFieldsEditCustom and only keep the ACTISUBTYPE definition.

    field.ACTISUBTYPE.Acti {[Hello World!]}

  2. Double check in Designer that in the form, the field NATURE is bounded to the ACTISUBTYPE definition.

  3. Reconnect in Efficy and hopefully you should see the "Hello World!"

Regards

answered by (7.4k points)
Welcome to Efficy Overflow, where you can ask questions and receive answers from other members of the community.
1,249 questions
1,519 answers
1,859 comments
328 users