Announcement

Collapse
No announcement yet.

Dynamic form

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic form

    Hiho,


    Code:
    {
      "formDependency": {
        "stage": {
          "map": {
            "Closed Won" : [
              {
                "action": "show",
                "fields": ["name"]
              }
            ]
          },
          "default": [
             {
                 "action": "hide",
                 "fields": ["name"]
             }
           ]
        }
      }
    }


    I found the code on the blog and working properly . I would like to apply it to hide and show fields in the sales stage . There is a possibility?

  • #2

    I want to hide Closed Won, Closed Lose , etc.

    Comment


    • #3
      client/modules/crm/src/views/opportunity/fields/stage.js

      Listen to model, check your logic and use code like

      this.params.options = ['List', 'Of', 'Options']; // define options depending on conditions
      this.reRender(); // re-render only the current field

      Comment


      • #4

        I do not understand. I want to hide the inside stage of the order. I am sending a picture of exactly what I mean. You can be done ? I checked the files and I can not list the there anything

        Comment


        • #5

          Comment


          • #6

            We are happy to read , I have not encountered it yet . Thank you.

            Comment


            • #7

              I tried but it still does not solve my problem. Completely do not understand ... Some functions work others do not want to do

              Comment


              • #8

                The most appropriate to the situation seems to be :

                Code:
                {
                            "action": "hide",
                            "options": ["stage", "ClosedWon"]
                },
                I do not understand the many intricacies of this system ...

                Comment


                • #9

                  custom/Espo/Custom/Resources/metadata/entityDefs/Opportunity.json
                  PHP Code:
                  {
                     
                  "fields": {
                        
                  "stage": {
                            
                  "view""custom:views/opportunity/fields/stage"
                        
                  }
                     }


                  client/custom/src/views/opportunility/fields/stage
                  PHP Code:
                  Espo.define('custom:views/opportunity/fields/stage''crm:views/opportunity/fields/stage', function(Dep) {  
                      return 
                  Dep.extend({  
                          
                  setup: function() {    
                              
                  Dep.prototype.setup.call(this);    
                              
                  this.initialOptionList this.params.options;    
                              
                  this.manageOptions();        
                              
                  this.listenTo(this.model'change', function() {      
                                  
                  this.manageOptions();      
                                  
                  this.reRender();    
                              });  
                          },

                          
                  manageOptions: function() {    
                              
                  this.params.options Espo.Utils.clone(this.initialOptionList);    
                              if (
                  this.model.get('myField') == 'SomeValue') {      
                                  
                  // here unset some items in this.params.options

                              
                  }  
                          }  
                      });

                  }); 
                  This code is not tested.
                  Last edited by yuri; 08-29-2016, 01:11 PM.

                  Comment


                  • #10

                    I give up. Implementation of CRM at a road through hell . I'll stay with spreadsheets in Excel.

                    I could learn web programming instead of C ++ do not have him any good.

                    Comment


                    • #11
                      HI,
                      I'm still trying to solve my problem. Unfortunately it doesn't work event with a code that works well on JSFiddle.
                      Code is displayed properly in source, but even though I included the same version of JQuery as I did on Fiddle it doesn't work.

                      Does anybody know where could I make a mistake?

                      ------------------------------------

                      Dzień dobry,
                      nadal staram się rozwiązać mój problem, niestety ale nie udaje mi się nawet przy pomocy kodu, który bez problemu działa pod JSFiddle.
                      Kod jest poprawnie wyświetlany w źródle jednak nie działa mimo include JQuery w odpowiedniej wersji (Tej samej na jakiej korzystam na JSFiddle)

                      Czy ktoś wie gdzie mogłem popełnić błąd?



                      Code:
                      $("select[name='typZlecenia']").change(function(){ 
                        var secondSelect = $("select[name='stage']"); 
                        if($(this).val() == "programistyczne") {
                          secondSelect.find('option[value="Qualification"]').addClass('hidden');
                        } else {
                          secondSelect.find('option[value="Qualification"]').removeClass('hidden');
                        }
                      });

                      Comment


                      • #12
                        SPA applications has a high entry level. My previous post covers your questions at 90%. This code you wrote won't work because it's not joomla and not wordpress. All elements on the page are defined as a view class and can be re-rendered so your jquery bindings will be lost.

                        Comment


                        • #13

                          But work even solve the problem in 90 % do not know how to deal with the remaining 10%. I had to add code:
                          client/res/templates/fields/enum/edit.tpl
                          Everything works without a problem .
                          Edit this system is very difficult. I do not understand it

                          Comment


                          • #14
                            Soon such a feature will be avialable in Entity Manager through UI.

                            Comment


                            • #15

                              Later I will probably have to update and many features will stop working. I will try. So far this solution is enough for me

                              Comment

                              Working...
                              X