We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4385
    • 372 Posts
    I am trying to validate a field that has a default value, allow someone to submit a higher value but not allow a lower value. The lower value is dynamic and I would like to set the filed back to the default value. I have tried hooks and custom validators. The field keeps coming back blank, I can’t seem to get the value back in.

    works (but static value and can’t reset the field value):
    &validate=`amount:required:minValue=^500^`


    doesn’t work:
    &validate=`amount:required:minValue=[[!+fi.minimum]]`


    as a hook:
    <?php
    $myAmount = $hook->getValue('amount');
    $min = $hook->getValue('minimum');
    if ($myAmount<$min){
    	$hook->setValue('amount','Default Value');
    	$hook->addError('amount','too low');
    	return false;
    } else {
      return true;
    }
      DropboxUploader -- Upload files to a Dropbox account.
      DIG -- Dynamic Image Generator
      gus -- Google URL Shortener
      makeQR -- Uses google chart api to make QR codes.
      MODxTweeter -- Update your twitter status on publish.