Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorspykid
     

    Hi, I am stuck in somewhere in validations, Actually I have a form which is valid if any of the given fields are filled but I can't find any solution for this as validatesPresenceOf doesn't provide option for adding or conditions...

    Hope you understand my query, Sorry for my bad English

    Thanks

    • CommentAuthormerindol
     

    Hi spykid.

    Not sure to undertand what functionalities you miss. Maybe 'validatesFormatOf' function is what you need ?

    Please :

    • provide the content of your validate() function
    • tell us what's the output of the form (types)
    • tell us what sort of validation you want to do on those data

    Regards.

    • CommentAuthorinsanet
     
    mmmm, validatesPresenceOf is just a shorthand (for empty or isset,i think), nothing stop you to access the properties by hand, and make conditions.
    for throwing errors you can use something like this: $this->addError('category_id','You cant select a main category!.');
    • CommentAuthorspykid
     

    Actually I want that if any single value in the form is filled then the form is valid but it applies on either fields....

    • CommentAuthorspykid
     

    When I try to make if..else clause then it fails on OR conditions also... such as

    if(validatesPresenceOf('name') || validatesPresenceOf(email))

    Thanks

    • CommentAuthorKaste
     

    He meant 'by hand' like if (isset($this->name) || isset($this->email)) return true; etcetera