chrismiles / ezform Goto Github PK
View Code? Open in Web Editor NEWiOS form handling and validation library.
License: MIT License
iOS form handling and validation library.
License: MIT License
Hello
I'm trying to implement a EZFormRadioField with UIPickerView with setChoicesFromArray called dinalically based on other field value.
I check the values changing in
}
and in updateRegionCountry I update the EZFormRadioField content with a new array passed with setChoicesFromArray.
Everything work but when I open the picker I have the new values but the number of items shown are limited to previous array count.
I mean if first array assigned with setChoicesFromArray had 20 elements, and the new array has 30 elements, the Picker shows the new elements but only the first 20.
Please note that both choices and orderedKeys in EZFormRadioField have the right number of elements after the update, but the picker still shows only 20 elements
This part of code:
- (NSString *)valueOrUnselectedAtIndex:(NSUInteger)index
{
NSString *value = nil;
if (self.unselected) {
if (index == 0) {
value = self.unselected;
}
else {
NSString *key = [self.orderedKeys objectAtIndex:index - 1];
value = [self.choices valueForKey:key];
}
}
else {
NSString *key = [self.orderedKeys objectAtIndex:index];
value = [self.choices valueForKey:key];
}
return value;
}
... should use -(id)objectForKey
instead of -(id)valueForKey
.
Otherwise, if u use for example NSNumber as keys, u get:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[__NSCFNumber length]: unrecognized selector sent to instance
Demo projects compile failed at : EZFormValueTransformer.m:63:33:
Does anyone have the same issue?
(instancetype)valueTransformerWithKeyPath:(NSString *)keyPath
{
return [self valueTransformerWithBlock:^id(id input) {
if (input == nil) {
return nil;
}
if ([input isKindOfClass:[NSString class]]) {
return input;
}
// did we end up with an array? multi-select data
if ([input isKindOfClass:[NSArray class]]) {
// if it is an array of strings we can't map on that
if ([((NSArray *)input).firstObject isKindOfClass:[NSString class]]) {
return input;
}
NSMutableArray *keys = [NSMutableArray array];
for (id i in (NSArray *)input) {
[keys addObject:[i valueForKeyPath:keyPath]]; // <-------------------- Failed to compile
}
return [keys copy];
}
id value = [input valueForKeyPath:keyPath];
return value;
}];
}
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
(void)setFieldValue:(id)value canUpdateView:(BOOL)canUpdateView
{
[(id)self setActualFieldValue:value];
if (canUpdateView && [(id)self respondsToSelector:@selector(updateView)]) {
[(id)self updateView];
}
__strong EZForm *form = self.form;
[form formFieldDidChangeValue:self];
}
Is the EZFormField not intended to be used directly?
JP
I'm following the login demo exactly, and I can't get formInputFinishedOnLastField to fire.
Validation works, didUpdate fires, but never formInputFinished
Hey Chris,
I'm trying to configure EZForm framework and have some issues. When I have some existing data in textfields after viewDidLoad, validation not working if textField.validationMinCharacters > 0. I've tracked updateValidityIndicatorForField method, it's sending null to isValid method. When I start typing something in this field, the validator starting work as expected. Can you point me to the right direction, where to fix it? Thank you
P.S. the textField already has valid data, but isValid returns null (FALSE)
which saves the values? where the texts included in the form are saved?
Can be fixed if you add this to line 381 of EZFormTextField.m :
Is there a reason why EZFormRadioField uses NSException's instead of NSAsserts?
Can't install in Xcode9. I've a older project where I used this library now I need to update this project. When I open this with xcode 9, I notice this error, it says :
#import <EZForm/EZForm.h> File not found.
I tried with creating a new project and installing this library again. Same issue.
Can you help me ?
Hello
I need to handle my form dinamically.
I mean to enable and disable validation on certain fields due to other constraints
More in detail I have an email field (set by default with addValidator:EZFormEmailAddressValidator) I need to disable in a specific condition (so that EZform doesn't check if it contains an email address)
Is there a way to do it?
Thanks
Paolo
Problems I've encountered so far when using dequeueReusableCellWithIdentifier:forIndexPath::
Hi,
Is there a way you can publish you documentation on a website (like the wiki pages)? I understand you use appledoc, but I also know that it generates a complete html. Maybe you can publish that?
Thanks a lot!
When i input the character in textfield
this delegate method is not called.
Thnks
When is showing a correction and I tap on 'Return' button my string will be replaced with correct string and action that's setted to UIControlEventEditingChanged event isn't perform and here is bug because model value isn't updated. Example: I wrote 'Helo' will be suggested 'Hello' and I tap return button, in text field text is 'Hello' but model value remains 'Helo'. P.S. Sorry for my bad english...
Hey mate,
I'm about to recommend this for use in yet another project and I was going over the README with a colleague when I noticed that it keeps track of apps that use it. You can add this one for sure:
https://itunes.apple.com/au/app/kayako/id843956132?mt=8
A.
I have a login form with a validationMinCharacters of 6 on my password field. When the field is invalid I set the text to be red.
As soon as the field resigns first responder the text turns red even if the field contents are valid.
Here's the weird part... Its not my code that turning it red. I've set breakpoints and logging statements, and my invalid handler is not being called. It only seems to happen with the validationMinCharacters validator.
Any idea what's happening here?
I trying to add separator between field so would like to know if there is any option show the line?
The library has various validation methods but we cannot give any error message to the user.
For example if a field has a maximum value of 500 and it the user gives 600. It gives error indicator but does not give any feedback to user. I think it needs integrated message system that displays the error message below the views.
The currently available Podspec is still referencing 1.1.0 which is missing some features that have currently been merged in. It would be awesome to have these new features accessible to CocoaPods users.
There was discussion back in Feb about bumping the CocoaPods version to 1.1.5. Can we do this? It's been quite a while since the last release.
Setup:
-(void)viewDidLoad {
/*...*/
//First (of 6 culprits)
EZFormRadioField *sampleRateField = [[EZFormRadioField alloc] initWithKey:InitFormDevice_SampleRate_Key];
[sampleRateField setChoicesFromArray:self.sampleRateOptions];
sampleRateField.validationRequiresSelection = YES;
sampleRateField.validationRestrictedToChoiceValues = YES;
[sampleRateField setFieldValue:@"30"];
[self.initializationForm addFormField:sampleRateField];
/*...*/
// Radio/Select Fields (Use labels)
for (NSString *t in radioFields) {
EZFormRadioField *f = [self.initializationForm formFieldForKey:t];
if([t isEqualToString:InitFormDevice_SampleRate_Key]) [f useLabel:self.lblDeviceSampleRate];
/*...*/
}
}
/*
Initialization of the form fields, and wiring them up has already completed. Now i'm trying to leave the form via the UINavigationController (back button).
*/
-(void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.initializationForm unwireUserViews];
}
Error:
-[UILabel setInputView:]: unrecognized selector sent to instance 0x15d23ff0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel setInputView:]: unrecognized selector sent to instance 0x15d23ff0'
Using XCode 5, iOS7 (iOS6 SDK), iPhone 4S (just incase someone needed this information)
With only a few exceptions like viewDidUnload (deprecated), I followed exactly how the example project built up and tore down the fields. This only seems to occur with the combination of EZFormRadioFields and UILabels.
The reason why I bring this up is because every time I fire up this view, memory consumption increases a bit, but when leaving the view, it doesn't get released (using ARC, etc, etc). Figured I would have to use the unwireUserViews to fix this. For the most part, up until it hits that exception, the memory usage drops a little bit.
Could I be missing something?
Hello, im trying to use the EZForm lib with textFields and buttons inside tableViewCells - when the field clicked inside the cell the tableView adjust its position and so on. What is the proper way to do this? I'm searched for a long time and cant found nothing. And i'm having difficulties to generate the appledoc. I would appreciate a little help. Thank you!
I can't get the key value when using setChoicesFromKeys i only get the value.
Is there a way of getting the key value instead of the value itself?
My output is:
< EZFormInputControl: 0x17600220; baseClass = UIControl; frame = (12 516; 277 30); text = 'Space'; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x175d4a60>; layer = <CALayer: 0x17600120>>
There is no Key variable
Thanks
Meni
I've tried to edit existed model with EZFrom component
code cut from lib demo app
EZFormMultiRadioFormField *likesField = [[EZFormMultiRadioFormField alloc] initWithKey:EZFDRegistrationFormLikesKey];
likesField.choices = @{
@"everything" : @"Everything",
@"pizza" : @"Pizza",
@"pasta" : @"Pasta",
@"bacon" : @"Bacon",
@"salad" : @"Salad",
@"cheese" : @"Cheese",
@"tacos" : @"Tacos"
};
NSArray * predefinedFieldValues = [NSArray arrayWithObjects:@"pizza", @"tacos", nil];
[likesField setFieldValue:predefinedFieldValues];
I expected to see list with checked "pizza" and "tacos" items, but nothing happened
What wrong with my expectations? In other words: how to show multi radio form with predefined selected items? e.g. existed object edit form solution
tnx
I think it would be helpful to have a method that provides a way to get a list of all the validations that failed on a specific field. This would allow forms to provide specific messages to the user based on why a field is invalid.
Thanks for making this wonderful form validation library. Do you by any chance plan to add EZForm to CocoaPods?
That would make integrating, installing and getting updates for EZForm really easy.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.