Announcement

Collapse
No announcement yet.

Help with customization dynamic forms

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

  • Help with customization dynamic forms

    Hi,
    i can't get this to work after i have follow this guide:
    http://blog.espocrm.com/development/...dynamic-forms/

    what i am trying to do is to hide all fields i want by default (Array,Enum and etc...)
    and to show one by one if...
    i have created array field "products" one of the array option called "seo".
    so i want to show another array field(named "seotype") if seo was selected.

    and thats not working.

    Code:
    "formDependency": {
      "products": {
        "map": {
          "seo" : [
            {
              "action": "show",
              "fields": ["seotype"]
            }
          ]
        },
        "default": [
           {
               "action": "hide",
               "fields": ["seotype"]
           }
         ]
      }
    }
    Last edited by Ruslan; 09-13-2014, 08:06 AM.

  • #2
    Have you cleared cache? It could be also cached on client side.

    Comment


    • #3
      yes i have clear all the system cache and local cache and browser cache and cookies.
      the strange thing is that by "default" it need to be hidden but this also not working because i see immediately the field.
      how can i debug this to see where is the problem?

      Thanks

      Comment


      • #4
        This logic is in file client/src/views/record/detail.js

        Comment


        • #5
          all looks ok from what can i see.
          but its not working.
          can you check in your environment if its working?

          Comment


          • #6
            Can do it only on Monday.

            Comment


            • #7
              Great waiting for your reply

              Comment


              • #8
                Ok. Wrap your json into { ..... }

                Use http://jsonformatter.curiousconcept.com/ to check your json.

                Comment


                • #9
                  Hi Yuri,
                  the json code looks fine without any error and thats i know.
                  the problem that i don't understand is: if this code work in your environment, why it is not working in my?

                  Comment


                  • #10
                    Have you wrapped into {.. } ?

                    Comment


                    • #11
                      yes i did it. and still didn't work.
                      ​so i start digger deeper and found the problem. it was server caching (iis cache css,js,html) when i turn this off, all start working!
                      ​* so if someone will have the same Problem! check your hosting cach (if enabled).

                      i also found bug, if you select the option(in array or Enum) you have put in your if statement to hide by default and show only if the option is selected, the code will show this field.
                      but, if you will change in Enum field to another option or remove the select option from the array, the field that you want to be hidden if this option cannot be selected still will be shown and not hidden.
                      so we need to add else statement that will hide back the field.

                      so how can we add here else statement ?

                      i have more questions regarding this
                      ​1. how to use multi if then... with this code? or i need every time to copy this code for each field?
                      ​2. how to use "AND" "OR" i want to show some fields if one of 3 options was selected (this going for "OR") or if one option selected and another option selected then show (AND).
                      3. how to hide all "panel" if all the fields there by default are hidden? and show the panel if one of the field will be shown?

                      Thanks

                      Comment


                      • #12
                        Hi

                        This logic doesn't support this. You can write your own code in Record.Detail view. Just extend it. See as custom view classes redeclared in clientDefs for existing entities and create your own detail view file. You need to be pretty good in javascript to make it.

                        Comment


                        • #13
                          ok.
                          but how i can use this code with multi hide and show based on if statement ?
                          here is what i did, the code hide the 2 fields. but when i select from the array landing page the "landingpagesketch" files don't appear. only if i select the "seo" then the seo field appear.
                          whats wrong?

                          Code:
                          {
                          "formDependency": {
                            "products": {
                              "map": {
                                "seo" : [
                                  {
                                    "action": "show",
                                    "fields": ["seo"]
                                  }
                                  ],
                                "landing page" : [
                                  {
                                    "action": "show",
                                    "fields": ["landingpagesketch"]
                                  }        
                                ]
                              }, 
                              "default": [
                                 {
                                     "action": "hide", 
                                     "fields": ["seo","landingpagesketch"]
                                 }
                               ]
                            }
                          }
                          }

                          Comment


                          • #14
                            Try to add hide actions to "seo" and "landing page"
                            PHP Code:
                            {
                            "formDependency": {
                              
                            "products": {
                                
                            "map": {
                                  
                            "seo" : [
                                    {
                                      
                            "action""show",
                                      
                            "fields": ["seo"]
                                    },
                                    {
                                      
                            "action""hide",
                                      
                            "fields": ["landingpagesketch"]
                                    }
                                  ],
                                  
                            "landing page" : [
                                    {
                                      
                            "action""show",
                                      
                            "fields": ["landingpagesketch"]
                                    },
                                    {
                                      
                            "action""hide",
                                      
                            "fields": ["seo"]
                                    }       
                                  ]
                                }, 
                                
                            "default": [
                                   {
                                       
                            "action""hide"
                                       
                            "fields": ["seo","landingpagesketch"]
                                   }
                                 ]
                              }
                            }

                            Last edited by yuri; 09-17-2014, 05:11 PM.

                            Comment


                            • #15
                              Hi Yuri,
                              not that what i want.
                              i dont want to hide "landing page" if "seo" selected. what i want is simple task. if seo selected show "seo" field" if landing page selected show "landingpagesketch"
                              the problem here is if "seo" and "landing page" both are selected the system shows only one of them not both.
                              its looks like the funcastion works ones.
                              i just want to show different fields based on selected option from array.

                              Thanks for help

                              Comment

                              Working...
                              X