We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36805
    • 354 Posts
    I use custom validation and a custom action after successful validation by using parameters : &eFormOnValidate=`checkSignup` &eFormOnBeforeMailSent=`doSignup`

    I found out if I don’t do this in my &eFormOnBeforeMailSent function:
    $fields['housenr'] = $_POST['housenr'];
    $fields['zipcode'] = $_POST['zipcode'];

    the integers will have added thousands seperators. I don’t primarily use eForm to email but to validate and insert into a table. The seperators however destroy perfectly valid integers. I think it’s a "bugfeature" smiley It makes for pretty formatting in emails and that’s what eForm it is designed for. But: can I toggle this behaviour for eForm2db style usage?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Are you specifying a data type in the eform attribute of the form fields?
      case "integer":
          $value = number_format($value);
          break;
      case "float":
          $localeInfo = localeconv();
          $th_sep = empty($_lang['ef_thousands_separator'])?$localeInfo['thousands_sep']:$_lang['ef_thousands_separator'];
          $dec_point= $localeInfo['decimal_point'];
      $debugText .= 'Locale<pre>'.var_export($localeInfo,true).'</pre>';
          $value = number_format($value, 2, $dec_point, $th_sep);
          break;
      
        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
        • 36805
        • 354 Posts
        Quote from: sottwell at Apr 06, 2011, 10:43 PM

        Are you specifying a data type in the eform attribute of the form fields? [..]
        Yes, I tagged it :1:integer so it apparently triggers the number_format you pasted. I now realize just how easy I could hardcode it away. With some extra work I could also parameterize it. Thanks!