I am trying to create a form with a text field that has the following (presumably common) features:
- Contains an initial 'default' value, and
- Is required (ie, not blank)
Unless i'm missing something obvious, this doesn't appear easily possible using ad_form. If i include a {value "foo"} parameter for the form element, clear the "foo" text and submit the form with that element blank, the -on_submit block still gets "foo" as the value (presumably by design?).
A workaround is use a -validate block to test the new value against the original, and if they match then the user either didn't change the field, or deleted it. But you still can't tell which.
It'd be nice if we had two new form element parameters:
{initial_value ...} The value of the element when the form is first created, and
{default_value ...} The value used if the field is blank
with the existing {value ...}'s behaviour unchanged for backwards compatibility, and documented as 'both' of the above.