We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38357
    • 178 Posts
    Being relatively new to Modx I probably haven't read the fine print somewhere, so perhaps someone can shed some light on this.

    In battling with the Login package I have found that when I paste code into a Resource and save it, Modx alters that code, at least in the instance below:

    Using login.UpdateProfile as indicated in rtfm I paste the following code into a resource (editor toggled off).

    <p>[[!UpdateProfile? ]]</p>
    <div class="update-profile">
    <div class="updprof-error">[[+error.message]]</div>
    <div style="color: #66cc00;">[[+login.update_success:if=`[[+login.update_success]]`:is=`1`:then=`[[%login.profile_updated? &namespace=`login` &topic=`updateprofile`]]`]]
    <form class="form" action="[[~[[*id]]]]" method="post"><input type="hidden" name="nospam:blank" value="" /></div>
    <p> </p>
    <label for="fullname">[[!%login.fullname? &namespace=`login` &topic=`updateprofile`]] <span class="error">[[+error.fullname]]</span> </label> <input id="fullname" type="text" name="fullname" value="[[+fullname]]" />
    <p> </p>
    <label for="email">[[!%login.email]] <span class="error">[[+error.email]]</span> </label> <input id="email" type="text" name="email:required:email" value="[[+email]]" />
    <p> </p>
    <label for="phone">[[!%login.phone]] <span class="error">[[+error.phone]]</span> </label> <input id="phone" type="text" name="phone" value="[[+phone]]" />
    <p> </p>
    <label for="mobilephone">[[!%login.mobilephone]] <span class="error">[[+error.mobilephone]]</span> </label> <input id="mobilephone" type="text" name="mobilephone" value="[[+mobilephone]]" />
    <p> </p>
    <label for="address">[[!%login.address]] <span class="error">[[+error.address]]</span> </label> <input id="address" type="text" name="address" value="[[+address]]" />
    <p> </p>
    <label for="city">[[!%login.city]] <span class="error">[[+error.city]]</span> </label> <input id="city" type="text" name="city" value="[[+city]]" />
    <p> </p>
    <label for="state">[[!%login.state]] <span class="error">[[+error.state]]</span> </label> <input id="state" type="text" name="state" value="[[+state]]" />
    <p> </p>
    <label for="zip">[[!%login.zip]] <span class="error">[[+error.zip]]</span> </label> <input id="zip" type="text" name="zip" value="[[+zip]]" />
    <p> </p>
    <br class="clear" />
    <div class="form-buttons"><input type="submit" name="login-updprof-btn" value="[[!%login.update_profile]]" /></div></form>
    </div>
    


    Note the position of the closing </form> at the end of line 24.
    The following code is what is produced AFTER the resource has been saved and the Manager page refreshed. Note that the </form> statement has been moved from the last line up to close the <form> near the beginning of the code at Line 5 and that it no longer exists at the end:

    <p>[[!UpdateProfile? ]]</p>
    <div class="update-profile">
    <div class="updprof-error">[[+error.message]]</div>
    <div style="color: #66cc00;">[[+login.update_success:if=`[[+login.update_success]]`:is=`1`:then=`[[%login.profile_updated? &namespace=`login` &topic=`updateprofile`]]`]]
    <form class="form" action="[[~[[*id]]]]" method="post"><input type="hidden" name="nospam:blank" value="" /></form></div>
    <p> </p>
    <label for="fullname">[[!%login.fullname? &namespace=`login` &topic=`updateprofile`]] <span class="error">[[+error.fullname]]</span> </label> <input id="fullname" type="text" name="fullname" value="[[+fullname]]" />
    <p> </p>
    <label for="email">[[!%login.email]] <span class="error">[[+error.email]]</span> </label> <input id="email" type="text" name="email:required:email" value="[[+email]]" />
    <p> </p>
    <label for="phone">[[!%login.phone]] <span class="error">[[+error.phone]]</span> </label> <input id="phone" type="text" name="phone" value="[[+phone]]" />
    <p> </p>
    <label for="mobilephone">[[!%login.mobilephone]] <span class="error">[[+error.mobilephone]]</span> </label> <input id="mobilephone" type="text" name="mobilephone" value="[[+mobilephone]]" />
    <p> </p>
    <label for="address">[[!%login.address]] <span class="error">[[+error.address]]</span> </label> <input id="address" type="text" name="address" value="[[+address]]" />
    <p> </p>
    <label for="city">[[!%login.city]] <span class="error">[[+error.city]]</span> </label> <input id="city" type="text" name="city" value="[[+city]]" />
    <p> </p>
    <label for="state">[[!%login.state]] <span class="error">[[+error.state]]</span> </label> <input id="state" type="text" name="state" value="[[+state]]" />
    <p> </p>
    <label for="zip">[[!%login.zip]] <span class="error">[[+error.zip]]</span> </label> <input id="zip" type="text" name="zip" value="[[+zip]]" />
    <p> </p>
    <br class="clear" />
    <div class="form-buttons"><input type="submit" name="login-updprof-btn" value="[[!%login.update_profile]]" /></div>
    </div>


    As, like most, I use a testing server and then transfer to my production server, I initially copied the code for this page to my production server and couldn't fathom why it wouldn't work. The altered code will not work if copied directly. The ORIGINAL code must be inserted - Modx then changes it to the new format.

    [ed. note: bobd72 last edited this post 14 years, 4 months ago.]
      • 39932
      • 483 Posts
      In my experience, ModX has never altered my code in any way. In fact, that is one of the things I love about ModX. Now, thinking back... There was a time where I was mistaken about it adjusting my code. This was during my earlier days with ModX. The issue came from a misunderstanding of specific plugins (namely Login) and how it used which chunks and when. I also made some classic mistakes such as adjusting the originally provided chunks rather than passing my desired chunks as parameters.

      If I were you, I would take a look at the chunks for Login on your test server and your production server. I will almost guarantee that they are slightly different. This may be a result of a patch to Login or a forgotten step by yourself. Once you have verified that the chunks, themselves are the same you can determine what else may be causing the issue. If you are still having the same problem, you might simply uninstall (completely) Login and reinstall it again. If you are like me, you may have accessed and (accidentally) changed the related php without realizing it. I did this, as well, several times during my exploration of the ModX platform.

      Hope this helps!
        Website: Extended Dialog Development Blog: on Extended Dialog
        Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
        Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

        Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
        • 3749
        • 24,544 Posts
        When you say the editor is toggled, do you mean that the document is set to richtext, but you're switching to HTML view? If so, TinyMCE is mangling your code. If it's installed and the doc is set to richtext, Tiny will modify the code when you save.


        ------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using.
        MODX info for everyone: http://bobsguides.com/modx.html
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting