I'm having trouble getting the -validation block to work in a form.
I've been trying to add some additional fields to the admin screen for registering a user. i.e. I'm editing acs-subsite/lib/user-new.tcl
Here's the code fragment:
--
# Pre-generate user_id for double-click protection
set user_id [db_nextval acs_object_id_seq]
ad_form -name register -export {next_url user_id return_url} -form [auth::get_registration_form_elements]
# new stuff
ad_form -extend -name register -form {
{msisdn:text
{label "Mobile Number"}
}
{house_name_number:text
{label "House Name/Number"}
}
{street_name:text
{label "Street Name"}
}
{city_town:text
{label "City/Town"}
}
{county:text
{label "County"}
}
{postcode:text
{label "Post Code"}
}
{home_phone:text,optional
{label "Home/Evening Phone"}
}
{work_phone:text,optional
{label "Work/Daytime Phone"}
}
} -validate {
{msisdn
{0}
"Wrong length"
}
}
--
Although I know its parsing the validation block ok, when I enter the form it just allows the msisdn value through anyway... (hence I've set it to 0 at the moment to force it to fail)
Am I doing something wrong here? can you not use -validate on form extensions? To the best of my knowledge I've followed the documentation?
Any help gratefully received.
Simon