We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42414
    • 3 Posts
    Hello,

    I'd like to add the math-feature for register but I can't get it started:

    the call:
    &preHooks = `math`


    and added this to the registration form:
    <label for="math"><span>[[!+op1]] [[!+operator]] [[!+op2]]?</span><span class="error">[[+reg.error.math]]</span></label>
    <input type="text" name="math" value="" />
    <input type="hidden" name="op1" value="[[!+op1]]" />
    <input type="hidden" name="op2" value="[[!+op2]]" />
    <input type="hidden" name="operator" value="[[!+operator]]" />
    


    But the operators don't show up.

    Any ideas? Thanks in advance smiley
      • 3749
      • 24,544 Posts
      Try this:

      <label>[[!+fi.op1]] [[!+fi.operator]] [[!+fi.op2]]?</label>
      [[!+fi.error.math]]
      <input type="text" name="math:required" value="[[!+fi.math]]" />
      <input type="hidden" name="op1" value="[[!+fi.op1]]" />
      <input type="hidden" name="op2" value="[[!+fi.op2]]" />
      <input type="hidden" name="operator" value="[[!+fi.operator]]" />
        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
        • 42414
        • 3 Posts
        Sorry, my bad, I had in the call
        "&placeholderPrefix=`reg.`"

        so, my working chunk is:

        <label>[[!+reg.op1]] [[!+reg.operator]] [[!+reg.op2]]?</label>
        [[!+reg.error.math]]
        <input type="text" name="math:required" value="[[!+reg.math]]" />
        <input type="hidden" name="op1" value="[[!+reg.op1]]" />
        <input type="hidden" name="op2" value="[[!+reg.op2]]" />
        <input type="hidden" name="operator" value="[[!+reg.operator]]" />


        Thanks BobRay [ed. note: philipp last edited this post 13 years, 9 months ago.]
          • 3749
          • 24,544 Posts
          Glad you got it sorted.

          I think your original code might have worked with this:

          &placeholderPrefix=``
            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