I finally got it. Actually my colleague helped me with it. But for some time I found that validations in the ad_page_contract kept on reurning "Zero sized Reply".
This is how my friend Mello programmed it.
set error_message " "
proc_doc ad_return_complaint {exception_count exception_text} "Return a page complaining about the user's input (as opposed to an error in our software, for which ad_return_error is more appropriate)" {
global error_message
if { $exception_count == 1 } {
set problem_string "a problem"
set please_correct "it"
} else {
set problem_string "some problems"
set please_correct "them"
}
set error_message $exception_text
ad_return_template /www/templates/error
}
...where /www/templates/error is a template which displays error_message in a manner which conforms to our site's designs (in other words it uses the master template).
However, I found that ad-page contract validations like notnull on variables returns a zero sized reply when calling ad_page contract programmed as above.
I made a little modification
proc_doc ad_return_complaint {exception_count exception_text} "Return a page complaining about the user's input (as opposed to an error in our software, for which ad_return_error is more appropriate)" {
global error_message
if { $exception_count == 1 } {
set problem_string "a problem"
set please_correct "it"
} else {
set problem_string "some problems"
set please_correct "them"
}
set error_message $exception_text
doc_return 200 text/html [template::adp_parse [template::util::url_to_file "/www/templates/error" [ad_conn file]] {}]
}
The later seems to have corrected the error I was experiencing.
Thanks to everyone for responding .....