So i decided to do this & seems to be working, I hope it fall apart, please advice if i'm wrong. I added the validator function inside the registration function & called it from the process() function, its working, i hope it wont fall apart.
def registration():
parent=db.parent(request.args(0, cast=int))
def my_validator(form):
if db((db.children.id>0) & (db.children.parent==parent.id)).count() >=4:
form.errors.children_names=SPAN("The number of children has exceeded the required number")
db.children.parent.default=
parent.id form=SQLFORM(db.children)
if form.process(onvalidation=my_validator).accepted:
response.flash=T('Client Regitered')
return locals()