We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44539
    • 3 Posts
    Hello, I have included a contact form on my site. Its an one page portfolio site, so after succesfull form submission the user is on the same page and sees some confirmation message. I have included a math captcha. The problem is that AFTER form submission and consequent page reload all hidden math fields are empty.

    This is how my contact ressource looks like:

    [[!FormIt?
       &hooks = `math,spam,email`
       &emailTpl = `sent-Email`
       &emailUseFieldForSubject = `1`
       &emailTo = `[email protected]`
       &validate = `angebot:blank,
            name:required,
       	email:required:email,
       	subject:required,
       	message:required,
            math:required`
       &successMessage = `Hello [[!+fiR.name]],<br/>Thank you for your message bla bla bla.`
       &validationErrorMessage = `The validation of the form returned an error! Please check your input.`
       &store = `1`
    ]]
    
    [[$contactform]]
    
    [[!FormItRetriever? &placeholderPrefix=`fiR.`]]
    


    The critical part of my contactform looks like this:

    <div class="form-item">
             <p class="description">[[%cf-math_description]]</p>
             <div class="fullwidth">
                <label for="cf-math">[[!+fi.op1]] [[!+fi.operator:is=`-`:then=`minus`:else=`plus`]] [[!+fi.op2]] =</label>
                <p class="form-field-wrap"><input type="text" name="math" id="cf-math" class="form-field[[+fi.error.math:notempty=` error`]]" value="[[!+fi.math]]" /></p>
             </div>
             <input type="hidden" name="op1" value="[[!+fi.op1]]" />
             <input type="hidden" name="op2" value="[[!+fi.op2]]" />
             <input type="hidden" name="operator" value="[[!+fi.operator]]" />
             [[!+fi.error.math]]
    </div>
    


    Please can you tell me why the hidden form fields are empty after form submission?
      • 44539
      • 3 Posts
      No ideas?
      I have to push this sorry. Please help
      • Can you explain more? What do you mean about empty after submission? Successful submission or unsuccessful?

        Is the math showing on the form when you return to it after submission?

        Also, try email:email:required or simply email:required in the validation.

        oh, ummm.. what is this?
            <p class="description">[[%cf-math_description]]</p>


        What exactly is the % for in the tag? Should that be a chunk? ($)
          Frogabog- MODX Websites in Portland Oregon
          "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
          Having server issues? These guys have MODX Hosting perfected - SkyToaster
          • 44539
          • 3 Posts
          What do you mean about empty after submission? Successful submission or unsuccessful?
          - Successful submission

          Is the math showing on the form when you return to it after submission?
          - Yes, everything is there: The math question and the data I inputted.

          Also, try email:email:required or simply email:required in the validation.
          - Tried both, no effect. However, first of the email should be filled (:required), then validated as an email of proper format (:email). So email:required:email should be correct, isn't it?

          What exactly is the % for in the tag?
          - It is a translated string.

          By empty I mean that the fields fi.op1, fi.op2 and fi.operator are just empty smiley
          <input type="hidden" name="op1" value="[[!+fi.op1]]" />
          <input type="hidden" name="op2" value="[[!+fi.op2]]" />
          <input type="hidden" name="operator" value="[[!+fi.operator]]" />
          

          => value of hidden fields are empty

          <label for="cf-math">[[!+fi.op1]] [[!+fi.operator:is=`-`:then=`minus`:else=`plus`]] [[!+fi.op2]] =</label>

          => Label reads "[SPACE] minus/plus [SPACE] ="
          So math fields are blank.

          Again, this is a one-page portfolio site so the contactform redirects to the same site like this:
          <form method="post" action="#contact" id="contactform">
          [ed. note: frisko last edited this post 10 years, 9 months ago.]
          • Having never had to translate, I never bothered to look at translated strings. :~}

            The email:required is without email validation, yes. However for FormIt, to validate the email first you need to use email:email:required. http://rtfm.modx.com/display/ADDON/FormIt.Validators

            I ran into this blank field problem two days ago myself, and quite honestly I'm not sure how I solved it other than to make the form functional and validate. I must have done something right while fiddling, because they appeared and all is well. Been racking my brain trying to remember, sorry.

            I'm not sure if it really actually matters, but you may want to omit the spaces in your snippet calls and elsewhere such as here: [[+fi.error.math:notempty=` error`]]. The parameters should read like &parameterName=`condition` rather than &parameterName = `condition`. It may or may not be an issue, but it's good practice to not use spaces, regardless.

            The other thing that confuses me is that you say the math is there, and you fill in the data, submit, and it's still there. But then say it's not there, i.e. empty. When exactly is it empty?
              Frogabog- MODX Websites in Portland Oregon
              "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
              Having server issues? These guys have MODX Hosting perfected - SkyToaster
              • 17552
              • 46 Posts
              Hi together,

              I have the same problem like frisko. After a succesfull submission the math operators are empty. So this is the flow:

              - go on contact page
              - everthing is fine, fill out the form and submit
              - there is no redirect, so the same page is rendered again (with succes message)
              - now the math fields are empty, no second submission possible

              I hopefully cleared that out...

              It is in:
              -MODX 2.2.15 on PHP 5.5
              -MODX 2.3.2 on PHP 5.6

              Anyone same issues?

              Best regards,
              Kersten
                • 51272
                • 7 Posts
                Hi,

                We found and fixed the issue with the empty math operator fields. The fix will be merged into the next release (2.2.9) which is due somewhere at the end of this week.