Menu

#1534 [Porta] Form creation error for custom object

2.4.0
not-a-bug
nobody
None
Portal
High
2.4.0
defect
2018-01-31
2018-01-31
Pedro Manso
No

Hello everyone,

We are making a new extension in order to allow users to see a new type of object in a custom way.
In order to do that we are customizing the forms and creating a new one like follows:

<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3">
    <module_designs>
        <module_design id="itop-portal" xsi:type="portal">
        ...
        <forms>
                <form id="checkinstanceView">
                    <class>EM_CheckInstance</class>  <-- A class previously created and tested
                    <properties>
                    </properties>
                    <fields>
                    </fields>
                    <twig>
                        <div class="row">
                            <div class="col-sm-7">
                                <fieldset>
                                    <legend>Pedro</legend>
                                    <div class="col-sm-6">
                                        <div class="form_field" data-field-id="check_status" data-field-flags="read_only"/>
                                    </div>
                                </fieldset>
                            </div>
                            <div class="col-sm-5">
                                <fieldset>
                                    <legend>Manso</legend>
                                    <div class="col-sm-6">
                                        <div class="form_field" data-field-id="check_lastupdate" data-field-flags="read_only"/>
                                        <div class="form_field" data-field-id="check_lastchange" data-field-flags="read_only"/>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                        <div>
                            <div class="form_field" data-field-id="check_params"/>
                        </div>
                    </twig>
                    <modes>
                        <mode id="view"/>
                    </modes>
                </form>
            </forms>
        ...

And then we compile it, with the setup and we also test it with the toolkit, and we are getting the following error when we try to load the clients portal:

Oops! An error has occured.
Error while parsing portal configuration file : Could not create from [id="checkinstanceView"] from XML because of a DOM problem : Class tag must be defined (/module_design[itop-portal]/forms/form[checkinstanceView] at line 627)
Please contact your iTop administrator if the problem keeps happening.

It seems that we are passing the "class" tag empty, that its false. So we look the file "env-production\core\module_designs\itop-portal.xml" and it has the following content:

...
<form id="checkinstanceView">
          <class/>
          <properties>
            <display_mode/>
            <always_show_submit/>
          </properties>
          <fields>
            <field id="checkinstance_statustext">
              <slave/>
            </field>
            <field id="checkinstance_status">
              <slave/>
            </field>
            <field id="checkinstance_lastupdate">
              <slave/>
            </field>
            <field id="checkinstance_lastchange">
              <slave/>
            </field>
            <field id="checkinstance_params">
              <slave/>
            </field>
          </fields>
          <twig>
            <div class="row">
              <div class="col-sm-7">
                <fieldset>
                  <legend/>
                  <div class="col-sm-6">
                    <div class="form_field" data-field-id="checkinstance_status" data-field-flags="read_only"/>
                  </div>
                </fieldset>
              </div>
            </div>
          </twig>
          <modes>
            <mode id="view"/>
          </modes>
        </form>
      </forms>
...

In the previous file the tag "class" is empty, that why we are receiving the error.
On the other hand if we replace the code in "env-production\core\module_designs\itop-portal.xml" with the code of the extensions the portal begins to work fine.

How can I solve this problem?

Thank you very much in advance,
Kind regards.

1 Attachments

Discussion

  • Guillaume Lajarige

    Hello,

    Seems to be because you have omitted the _delta="define" attribute on your

    <form> tag. :)

    Guillaume

    </form>
     
  • Guillaume Lajarige

    Glad to hear!

    Have a nice day,
    Guillaume

     
  • Guillaume Lajarige

    • status: new --> not-a-bug
     

Log in to post a comment.

MongoDB Logo MongoDB