infinitered / ProMotion-form

Deprecated -- use ProMotion-XLForm
19 stars 11 forks source link

add validation support #5

Closed logicminds closed 9 years ago

logicminds commented 10 years ago

Would be awesome to have some built in validation support.

example:

def form_data
    [{
       title: "New Item",
       footer: "footer text",
       cells: [{
                 name: "name",
                 title: "name",
                 type: :text,
                 validate: /[0-9]+/
               },
               {
                 name: "email",
                 title: "email",
                 type: :email,
                 validate: validate_email
               }
              ]
     }]
end

def validate_email(value)
     value ~= /\w+\@{1}.*/
end

def on_validation_success
    # enable save button
end

def on_validation_failure
    # popup alert
end

Would also be cool to run the values through a regex, code block or predefined set of validation class code. If validation passes/fails call a hook method.

jamonholmgren commented 10 years ago

Hey @logicminds, great idea. There are some things in the works for form validations...I'll keep you posted. :)

markrickert commented 9 years ago

@GantMan has done some really awesome work on rmq validations. I might suggest using those instead of building them into this library. http://rubymotionquery.com/?s=validation&post_type=document

jamonholmgren commented 9 years ago

ProMotion-form has been officially deprecated. Thanks everyone!

http://jamonholmgren.com/deprecating-promotion-form/