Editor Custom Form

Editor Custom Form

jmorejmore Posts: 19Questions: 4Answers: 1

Hi,
I am using the editor with a custom form and it works great. The custom form is generated through the use of a Jade like template compiler (vibe.d -- diet templates). This allows me to embed 'D' code in the template so at load time I can alter the output HTML.
The following is the definition in the template language.

    div#customForm
      fieldset.name
        legend Path To Device
        editor-field(name='depotName')
        editor-field(name='clientName')
        editor-field(name='rtuName')
      fieldset.name
        legend device
        editor-field(name='deviceName')
        editor-field(name='serialNumber')
        editor-field(name='assetNumber')
        editor-field(name='location')
        editor-field(name='ipAddress')
        editor-field(name='deviceType')
        editor-field(name='deviceStatusMessage')
        - if (!anySet(perms[Permissions.printerQuiesce..Permissions.printerQuiesce+1]))
          editor-field(name='quiesce')
        - if (!anySet(perms[Permissions.printerManualDataUpdate..Permissions.printerManualDataUpdate+1]))
          editor-field(name='serviceTag')
          editor-field(name='eventId')       
      fieldset.editable
        legend User Configurable Fields
        - if (anySet(perms[Permissions.printerQuiesce..Permissions.printerQuiesce+1]))
          editor-field(name='quiesce')
        - if (anySet(perms[Permissions.printerManualDataUpdate..Permissions.printerManualDataUpdate+1]))
          editor-field(name='serviceTag')
          editor-field(name='eventId')

The '- if' statements are executed at load time and basically they are checking a bit map of user permissions for the current session user and will cause the appropriate HTML to be generated. Based on the user permissions I alter the location of the fields on the form.
What I would also like to do is not allow input for the quiesce, serviceTag, and eventFilter fields unless they are generated under the User Configurable Fields section of the form. Can I add some tag to the editor-field (like readonly) to achieve this without resorting to javascript after the load. I would rather not have anything to do with the permissioning show up in the loaded page.

I appreciate any assistance you may be able to provide.

Answers

  • allanallan Posts: 63,210Questions: 1Answers: 10,415 Site admin

    Can I add some tag to the editor-field (like readonly)

    There is the readonly field type that you might find useful?

    Allan

This discussion has been closed.