Menu

Show request form in read only mode on the portal

2023-02-21
2023-03-29
  • Bottin Jean-Francois

    When you use the "Custom Request Forms" extension, and you try to allow users to see the form they filled out during their request, it will be reset if a comment is recorded on the ticket.

    After our analysis, iTop does not provide for read-only display of fieldsets as standard, unlike other field types. At registration, it tries to update the ticket with the editable content which is non-existent, and therefore empties the form.

    We propose the following modification on the core side to allow this read-only display :
    in sourcesrenderer/bootstrapfieldrendererbssubformfieldrenderer.class.inc.php, at the end of the render function :

    add >>                     if (!$this->oField->GetReadOnly())
    add >>                {
                            $sFieldSetOptions = json_encode($aFieldSetOptions);
                            $oOutput->AddJs(
    <<<EOF
                            $("#fieldset_{$this->oField->GetGlobalId()}").field_set($sFieldSetOptions);
                            $("[data-field-id='{$this->oField->GetId()}'][data-form-path='{$this->oField->GetFormPath()}']").subform_field({field_set: $("#fieldset_{$this->oField->GetGlobalId()}")});
    EOF
                                    );
    add >>                }
    add >>                else
    add >>                {
    add >>                        $sFieldSetOptions = json_encode($aFieldSetOptions);
    add >>                        $oOutput->AddJs(
    add >><<<EOF
    add >>                        $("#fieldset_{$this->oField->GetGlobalId()}").field_set($sFieldSetOptions);
    add >>EOF
    add >>                                );
    add >>                }
                    return $oOutput;
            }       
    
     
  • Pierre Goiffon

    Pierre Goiffon - 2023-03-29

    Hello,
    Can you provide a step by step way to reproduce please ?
    Also, note we're opened to contributions

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.