On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi

    First of all, sorry if this has been answered somewhere. I have looked everywhere for 2-3 hours and haven't find an answer.
    I'm creating a site and some of the users will be people old enough to not have and not want an email address. I noticed an email address is needed to send a comment through Quip.

    Here's where I need help. I need to either set email as not mandatory OR set a default email that points to a non-existing address on the domain.
    I went through the Quip reply snippet and added some code to check if the posted field is empty and edit accordingly, but no luck.
    Where should I be looking at to make this work? I thought about adding it to the template that creates the form, but I don't know if modx tolerates php in those templates and that way I don't know if I'd be destroying the ability to pull user data from those logged in to the manager back end.

    Hope I'm making any sense.
    • Hi,

      I know it's an old post but i struggled a few hours with the same problem and didn't found a real solution to make the mail input optional.
      For now I'm using a little turnaround. Probably not the smartest way but maybe it'll help.

      <script type="text/javascript">
          function addText() {
              var input = document.getElementById('quip-comment-email-qcom');        
              var mail = $('#quip-comment-email-qcom').val();
      	    if(mail == "" ) {
      	         input.value = 'no mail' ;
      <form id="quip-add-comment-[[+idprefix]]" action="[[+url]]#quip-comment-preview-box-[[+idprefix]]" method="post" onsubmit="addText()">
      • An easier and JavaScript-free solution is to pass an hidden input field for the e-mail.

        In template tplAddComment:

        Uncomment the default label and input field for e-mail..
        <p class="quip-fld">
        <label for="quip-comment-email-[[+idprefix]]" class="required">[[%quip.email]] <span class="quip-error">[[+error.email]]</span></label>
        <input type="text" name="email" id="quip-comment-email-[[+idprefix]]" value="[[+email]]" required="required" placeholder="Ihre E-Mail-Adresse" />

        ..and add an hidden input field
        <input type="hidden" name="auth_nonce" value="[[+auth_nonce]]" />
        <input type="hidden" name="preview_mode" value="[[+preview_mode]]" />
        [[- E-MAIL HERE]]
        <input type="hidden" name="email" value="no-email@yourdomain.tld" />

        • Thank you Sebastian. Your way is good, if i don't need the mail field at all, but for my project i need the email field to be optional. I think it wouldn't work then with the hidden field.
          • Sorry, I didn't get this!
            You're right, desper.
            With my posted solution, users are not able to submit there e-mail-address.