chrismiles / EZForm

iOS form handling and validation library.
MIT License
284 stars 64 forks source link

Clarification on setting a simple EZFormField #66

Closed johndpope closed 9 years ago

johndpope commented 9 years ago

Hi Chris,

Nice job on this library.

I wonder if you could clarify how to use / set fields that don't necessarily have an associated uilabel / uitextfield.

static NSString const EZFDRegistrationFormIssueLatitudeKey = @"Latitude"; static NSString const EZFDRegistrationFormIssueLongitudeKey = @"Longitude";

I am basically hooking up the formfields like this

        EZFormField *lat = [[EZFormField alloc]initWithKey:EZFDRegistrationFormIssueLatitudeKey];
        [form addFormField:lat];
        EZFormField *lng = [[EZFormField alloc]initWithKey:EZFDRegistrationFormIssueLongitudeKey];
        [form addFormField:lng];

then later in the class - trying to set this values. [formDelegate.form setModelValue:[NSString stringWithFormat:@"%f", c.latitude] forKey:EZFDRegistrationFormIssueLatitudeKey]; [formDelegate.form setModelValue:[NSString stringWithFormat:@"%f", c.longitude] forKey:EZFDRegistrationFormIssueLongitudeKey];

[EZFormField setActualFieldValue:]: unrecognized selector sent to instance 0x170450f50

Is the EZFormField not intended to be used directly?

JP

chrismiles commented 9 years ago

That's right, EZFormField isn't meant to be used directly. It is an abstract base class.

You can simply use a EZFormTextField (or any other concrete field type) with no control wired up. The form fields don't require UI to be attached.

Cheers, Chris