Giter VIP home page Giter VIP logo

bzgformfield's People

Contributors

jhersh avatar jtmilne avatar mjjimenez avatar vprtwn avatar wzs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bzgformfield's Issues

Alert view is not displayed

I've declared an alert view message ,but it's never shown:
if (![text validateMinimumLength:8]) { field.alertView.title = @"Password is too short"; return NO; } else { return YES; }

Override #define values

I'd like to override some values, such as DEFAULT_LEFT_INDICATOR_INACTIVE_ASPECT_RATIO
, in my app and wondering how this should be done.

For example, if this was a @Property then it could be changed easily. Please do point out if it is possible to override a #define, as you have here.

Add BZGFormField to validation block arguments

Hi again! Just wanted to ask what you think about including the instance of the bzgformfield on the textvalidation block? I think it would be more convenient as opposed to having to use weakSelf to access the bzgformfield inside the validation block.

typedef BOOL (^BZGTextValidationBlock)(BZGFormField *field, NSString *text);

//Setting validation block
[self.formField setTextValidationBlock:^BOOL(BZGFormField *field, NSString *text){

//Validate text

//Add error message
field.alterView.title = @"Error Message.";

}];

Thanks!

cocoapod! :)

Let me know if you need help making a podspec.

When Adding BZGFormField class to uiView I get invalid class error

When I try to load the class in view, I get this error.
Unknown class BZGFormField in Interface Builder file.
-[UITextField textField]: unrecognized selector sent to instance 0x99b3130
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextField textField]: unrecognized selector sent to instance 0x99b3130'

Unable to add BZGFormField on UITextField

Hi,
I am trying to add BZGFormField on UITextField. However, I am getting following errors. Please guide me, how to add BZGFormField on UITextField.

---.h file -----

import <UIKit/UIKit.h>

import "BZGFormField.h"

@protocol BZGFormFieldDelegate;

@interface AuthenticationViewController : UIViewController

@Property(strong,nonatomic) UITextField BZGFormField *emailField;
@Property(strong,nonatomic) UITextField *passwordField;
@Property(strong,nonatomic) UITextField *passwordConfirmField;

-(void)loadLoginForm;
-(void)loadRegistrationForm;
@EnD

-----.m -----

import "AuthenticationViewController.h"

import "BZGFormField.h"

@interface AuthenticationViewController ()

@EnD

@implementation AuthenticationViewController

  • (void)viewDidLoad
    {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self loadLoginForm];
    }

-(void)loadLoginForm
{
NSLog(@"AuthenticationViewController loadLoginForm");

self.emailField = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 230, 30)];

self.emailField.text = @"";
self.emailField.placeholder = @"Email";
self.emailField.borderStyle = UITextBorderStyleRoundedRect;
   [self.emailField setTextValidationBlock:^BOOL(BZGFormField *field, NSString *text) {
    // from https://github.com/benmcredmond/DHValidation/blob/master/DHValidation.m
    NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
    if (![emailTest evaluateWithObject:text]) {
        field.alertView.title = @"Invalid email address";
        return NO;
    } else {
        return YES;
    }
}];
self.emailField.delegate = self;
[self.view addSubview:self.emailField];

}

@Property(strong,nonatomic) UITextField BZGFormField *emailField;
Error :
---Interface type cannot be statically allocated
---Cannot declare variable inside @interface or @protocol

[self.emailField setTextValidationBlock:^BOOL(BZGFormField *field, NSString *text) {
Error:
---No visible @interface for 'UITextField' declares the selector 'setTextValidationBlock:'

Error when setting validation block

The example for setting a validation block is

[self.passwordField setTextValidationBlock:^BOOL(BZGFormField *field, NSString *text) {
    if (text.length < 8) {
        field.alertView.title = @"Password is too short";
        return NO;
    } else {
        return YES;
    }
}];

When I do this however, I get

screen shot 2014-02-23 at 22 21 57

May the example be outdated?

Fields can be marked as required

Hi all! I plan to extend this library to support a 'required' boolean. Fields that are required will be marked differently while they are empty. If they have text then normal validation will take place.

Let me know your thoughts on this! I wil use similar UI to the invalid UI (not sure exactly what it will look like)

thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.