We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8898
    • 181 Posts
    Quote from: ottogal at Oct 25, 2012, 04:21 AM
    I just saw that my plugin code above has to be hardened for the case you create a new resource.
    Line 3
    $id = $resource->get('id');
    would throw a Fatal error "Call to a member function get() on a non-object" because the id of the new resource is not defined unless it is saved for the first time.
    So there is the need to treat this case seperately. I'll try that as soon as I find the time to do so.
    I used

    if ('upd' == $mode)

    for that. So it is executed only if the Resource has already been saved once. As stated above, the TV is hidden via Form Customization when creating the Resource.

    Cheers,
    Jan
      This message has been ROT-13 encrypted twice for higher security.
      • 22427
      • 793 Posts
      Ah, yes. I overlooked that.

      When you use Form Customization, you could hide the one-option radio button too and display the TV value in another, non editable way. That would avoid the mentioned irritation for the editor user - but in that case you could stay with a TV of type Text too...
        • 8898
        • 181 Posts
        Quote from: ottogal at Oct 25, 2012, 05:20 AM
        When you use Form Customization, you could hide the one-option radio button too and display the TV value in another, non editable way.
        Hm, how can I achieve this with Form Customization? I can hide the TV completely, change its label etc., but how can I hide the radio button portion of it there? I'd rather use a Plugin for that, too...

        Cheers,
        Jan
          This message has been ROT-13 encrypted twice for higher security.
          • 22427
          • 793 Posts
          I must admit that I know Form Customization just in theory. The problem is, I cannot try it - bcause I cannot even create a new User Group.

          If, in Access Controls, I click the button New User Group and insert a Name, the button Save shows no reaction. Just the button Close is working. This is with a local installationof 2.2.5-pl on my PC (Win7, xampp).
          When I try it on a live installation on my notebook, the panel to create a new User Group is positioned to high - I cannot even access the Name field! And there is no possibility to scroll that panel.

          So I gave up...
          • It looks like there is a required field when creating a new user group; on the right the Manager Policy gets a red wavy underline if you try to save without setting that. You can select "No Policy" if this will be a front-end user.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 22427
              • 793 Posts
              Thank you, Susan. Setting the Manager Policy to no policy helped indeed. (But the red wavy underline didn't show up...)
              • I've learned from hard experience that the usual reason for a "save" button not doing anything is because of a required field. This is not always clearly shown, as in this case, or in the case of smaller display windows where the page needs to be scrolled to see that a field is required.

                For example, the MIGXdb TV for handling child resources (http://rtfm.modx.com/display/ADDON/MIGXdb.Manage+Child-Resources+in+a+grid-TV+with+help+of+MIGXdb) wouldn't work if the System Settings for automatic alias wasn't enabled, as an alias is a required field for saving a resource. The tutorial only has two fields, so if the alias wasn't automatically generated then the save would fail with no way to know why.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org