Forum OpenACS Development: template::element validation question

Collapse
Posted by Jeff Lu on
I dont seem to understand how the -validate works heres my code:

ad_page_contract { } { }
template::form::create myform
template::element::create myform t1 -widget text -datatype integer -label "textbox" -validate { ?how do i do this? }
template::element::create myform submit1 -widget submit -label "submit"

i just want to try to validate the textbox input for ex. input should be greater than 5.
I cant seem to get it to work properly.
thanks
Collapse
Posted by Robert Locke on
Hi Jeff,

You should consider using ad_form which greatly simplifies form creation and management.

Check out the docs for an example which demonstrates exactly what you want.

Collapse
Posted by Jeff Lu on
thanks. Im already familiar with ad_form. I really need template::element -validate since i am going to work on a project which was done on acs 4.2 and it doesnt have ad_form yet.
Collapse
Posted by Robert Locke on
Docs to the rescue again! Check out the -validate option for the state field.
Collapse
Posted by Jeff Lu on
thanks robert! I really feel like Im stupid for not looking at the docs properly.
Collapse
Posted by Robert Locke on
Don't feel stupid!  Truth be told, I only found it by grep'ping around.

Good luck!

Collapse
Posted by Jeff Lu on
Alright Ive gotten it to work! thanks alot Robert!