GithubHelp home page GithubHelp logo

fxforms's People

Contributors

adamcian avatar ashton-w avatar bartvandendriessche avatar bobspryn avatar bumaociyuan avatar donnalea avatar felipelc avatar gantman avatar gtranchedone avatar hanneskaeufler avatar januzellij avatar jhersh avatar jlajlar avatar joepestro avatar masa-beheim avatar nicklockwood avatar pjcook avatar plandem avatar qfish avatar rynaardb avatar samuele-mrapps avatar sdesimone avatar streeter avatar theill avatar waterskier2007 avatar wimbledon avatar yakubbaev 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  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

fxforms's Issues

FXFormTextViewCell resizing the cell height

When the FXFormTextViewCell is resized due to multiple lines input, the tableview's other cells below the textViewCell does not update their position properly. This issue is evident when you push to the subForm and return to the parent form.

Crash after `reloadData`

Hey there,

so i'll start simple, something visual is worth a thousand words:

crash - fxforms

Now i'll explain a bit what we can see in that gif.

I have a two properties, one NSString and one NSNumber. The first one is shown as a label not editable and the second is a UISliderCell that have action on the first one.

Now the code is fairly simple:

Interface

@interface sizeForm : NSObject <FXForm>

@property (nonatomic, retain) NSString  *maxStorageSize;
@property (nonatomic, retain) NSNumber  *limitStorageSize;

@end

implementation

- (void)setLimitStorageSize:(NSNumber *)limitStorageSize
{
    if (_limitStorageSize == limitStorageSize || [_limitStorageSize isEqualToNumber:limitStorageSize])
        return ;

    ReleaseAndNil(_limitStorageSize);
    _limitStorageSize = [limitStorageSize retain];

    if (!_limitStorageSize)
        return ;

    [[settingsManager instance] save:_limitStorageSize forKey:kMaxSize];
    self.maxStorageSize = [_formatter stringFromNumberOfBits:_limitStorageSize];

    [[NSNotificationCenter defaultCenter] postNotificationName:@"ReloadFxForm" object:self userInfo:@{@"form" : self}];
}

Now you can see that the maxStorageSize (NSString) is being edited by the NSNumber property setter. The question then was, how to update the label, more specifically how to tell the form to refresh the cell / label.

Well what i thought, is to tell the formViewController to update / reload the tableview through a notification (that last line).

Which for now simple call this:

- (void)handleNotification:(NSNotification*)note
{
    NSLog(@"Got notified: %@", note);

    [_formTableView reloadData];
}

Now as you can see, it works fine for a while, but then when you release the slider and try to play with it again it crash automatically.

I think there is something with the cells being reloaded and the field being destroyed but i lack some informations to fix this. (maybe dispatch to a thread or using synchronized ?)

the crash

here, i'll give you as much informations as i can on the crash:

image 2014-04-17 at 12 31 22 pm

backtrace

* thread #1: tid = 0x4f9204, 0x026840b2 libobjc.A.dylib`objc_msgSend + 14, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x20b8a8ac)
    frame #0: 0x026840b2 libobjc.A.dylib`objc_msgSend + 14
  * frame #1: 0x0007d4f8 -ios-app`-[FXFormSliderCell valueChanged](self=0x0b8a0190, _cmd=0x000c00db) + 264 at FXForms.m:2227
    frame #2: 0x02686880 libobjc.A.dylib`-[NSObject performSelector:withObject:withObject:] + 77
    frame #3: 0x011b23b9 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 108
    frame #4: 0x011b2345 UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
    frame #5: 0x012b3bd1 UIKit`-[UIControl sendAction:to:forEvent:] + 66
    frame #6: 0x012b3fc6 UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 577
    frame #7: 0x01364b42 UIKit`-[UISlider beginTrackingWithTouch:withEvent:] + 1051
    frame #8: 0x012b2c79 UIKit`-[UIControl touchesBegan:withEvent:] + 106
    frame #9: 0x015482e3 UIKit`_UIGestureRecognizerUpdate + 7166
    frame #10: 0x011f1a5a UIKit`-[UIWindow _sendGesturesForEvent:] + 1291
    frame #11: 0x011f2971 UIKit`-[UIWindow sendEvent:] + 1021
    frame #12: 0x011c45f2 UIKit`-[UIApplication sendEvent:] + 242
    frame #13: 0x011ae353 UIKit`_UIApplicationHandleEventQueue + 11455
    frame #14: 0x0287e77f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    frame #15: 0x0287e10b CoreFoundation`__CFRunLoopDoSources0 + 235
    frame #16: 0x0289b1ae CoreFoundation`__CFRunLoopRun + 910
    frame #17: 0x0289a9d3 CoreFoundation`CFRunLoopRunSpecific + 467
    frame #18: 0x0289a7eb CoreFoundation`CFRunLoopRunInMode + 123
    frame #19: 0x041695ee GraphicsServices`GSEventRunModal + 192
    frame #20: 0x0416942b GraphicsServices`GSEventRun + 104
    frame #21: 0x011b0f9b UIKit`UIApplicationMain + 1225
    frame #22: 0x0001b549 `main(argc=1, argv=0xbfffe8b8) + 169 at main.m:29

If i can be of any help, let me know.

Once again great work !

TextLabel Alignment Center

Hi, I've tried doing this in the fields method for a specific field:
@"textLabel.textAlignment":[NSNumber numberWithInteger:NSTextAlignmentCenter]

But it doesn't work unfortunately. Is there a way this can work?

Fields method

I need to define the fields without using class properties because I create dynamically the fields to display reading them from the database.
So I can see correctly all the fields in the table but I can't get their entered value on submit.

MyForm *form = cell.field.form;

If I iterate all form.fields items I see only:
{
key = field1;
title = Field1;
type = text;
}
{
key = field2;
title = Field2;
type = text;
}
[...]
How can I get the values?

Thank you

Can't access form field values from view controller

I love this library so far, but can't figure out how to properly access the values in the form from the view controller. I'm trying to access them when a rightbarbuttonitem is clicked, but keep getting (null) - see below.

I must be missing something really obvious. A nudge in the right direction would be highly appreciated.

FXForm View controller:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

// Add the right bar button item
    UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(addProvider)];
    self.navigationItem.rightBarButtonItem = saveButton;

}

- (void)addProvider
{
    ManualEntryProviderForm *mepf = self.formController.form;
    NSLog(@"Address1: %@", mepf.address1); // Shows Address1: (null) in console
}

View controller that displays the FXForm View controller:

- (void)clickProviderNotFound {
    ManualEntryProviderViewController *fvc = [[ManualEntryProviderViewController alloc] init];

    fvc.formController.form = [[ManualEntryProviderForm alloc] init];
    [self.navigationController pushViewController:fvc animated:YES];
}

Intercept input value and change another field in the form

Thank you for this great great library it really makes building forms much easier.

Im having a problem with changing a field's options based on the user input in another field. Lets assume I have a list of 3 products: Juice, water, coffee. if the user selects juice or water then he/she can select multiple options for these products at once. If the selected product is however coffee then only one option can be selected (See code below).

I have no idea how to get the select product value and change the options based on that using FXForms. In the documentation you mention KVO and custom setter, but since Im new to IOS development I find it hard to understand without some examples, .

I hope you can give an example on how to intercept input values and update fields based on input :).

typedef NS_ENUM(NSInteger,Product)
{
Juice = 0,
water,
coffee
};

typedef NS_OPTIONS(NSInteger, Options)
{
Option1 = 1 << 0,
Option2 = 1 << 1,
Option3 = 1 << 2
};
@interface ProductSelectionForm : NSObject < FXForm >
@Property (nonatomic, assign)Product productList;
@Property (nonatomic, assign) Options productOptions;
@EnD

Confused about usage

Hello,

First and foremost, sorry for bringing this up as an issue, but I couldn't wrap my head around some way of doing this:

I have a basic signup form and have two issues with it so far:

  1. Is there any way of styling the whole form without having to do it on a field-by-field basis?
  2. I have a small options table that should display some text and an image for each option.
    I tried creating an FXFormBaseCell subclass, but, how would I specify how to fill out each cell? Do I need to create a new FXFormField? And finally, upon selection (single selection), how can I display that data (image + text) in the original form?

Thank you!

Format text on option field

Hi Nick, how do you format the label used to show the currently selected option in an option field like this? I tried optionLabel but doesn't work.

return @{FXFormFieldKey: @"secretQuestion",
FXFormFieldTitle: @"QUESTION (*)",
FXFormFieldOptions: questions,
@"textLabel.font": kFontNormal(14),
@"optionLabel.font": kFontNormal(14)};

How to Add Custom Button

Hi there,

Is there any way can let me add a custom button to the form? I've look through the FXForms.h library but don't see any button related functions there.

Correct me if I am wrong ya ๐Ÿ‘ hope you have a nice day ahead.

Keyboard Next field

If I have multiple fields, the user has to manually tap the next field while it's much more user-friendly if instead of 'Done', the keyboard displays 'Next' IF there's still another field below the current field, and it then jumps to the next field when pressing Next! :)

Updating the Placeholder string (Model/View communication)

Hi Nick,

I have question regarding updating the placeholder and model view communication. I've set up a form where people can search for their city. Therefor I set up a view controller form field like this:

@{ FXFormFieldKey : @"cityViewController", FXFormFieldTitle : NSLocalizedString(@"CITY", nil), FXFormFieldPlaceholder : self.selectedCity },

The cityViewController is presented with a search interface which works quite well. In there I declared a @property NSDictionary to hold the users selection from the search results. I want to communicate that selection back to the form model and adjust the placeholder string to the current value of the selected city.

I can see that in cityViewController.selectedEntry the current selection is stored so that's working ok. But how can I adjust the placeholder to display the current city accordingly?

I wonder if there might be a better way to do what I try?
Thanks so much for your work and help!

Dismissal of inputView

Hi,

First of all - thanks a lot for sharing this project. It's coming in handy.

I believe the following should be added before pushing to a new VC:
[controller.view endEditing:YES];

Otherwise the various inputs stay visible when you pop back to the form from the options screen.

Automatic firstResponder

Is there a way to immediately make the first textfield the firstresponder so the keyboard immediately pops up?

null model value crashes app

I just started using FXForms - looks really promising for reducing work I have to do. My first attempt to implement a form using an NSManagedObject as my FXForm (assume this is valid). Here's my exception:

2014-04-05 16:16:58.530 Lacrosse-Stats[16049:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<team 0xd0781b0> valueForUndefinedKey:]: the entity (null) is not key value coding-compliant for the key "state".'

Apparently, there is no value for the "state" field (a US State). It is not mandatory in my app. I would assume FXForm can handle null values so I must be doing something wrong. Any suggestions?

FXFormFieldPlaceholder not available

When I try to set the FXFormFieldPlaceholder like this:

- (NSArray *)fields
{
    return @[
             @{ FXFormFieldKey : @"genderType", FXFormFieldTitle : NSLocalizedString(@"REGISTER_DU_BIST", nil), FXFormFieldPlaceholder : @"test" },
}

I get

Use of undeclared identifier 'FXFormFieldPlaceholder'; did you mean 'FXFormFieldHeader'?

Indeed I can't find the declaration for it in FXForms.h. Documentation says there is such a property?!

Customize headers

Is is currently possible to customize the section headers, e.g. changing the font? Or to provide a custom UIView for the section headers?

FXFormFieldOptions - on row tap, not loading options

Hey,

Need some help! I've setup FXForms, great job! But when I setup FXFormFieldOptions, the row appears, but when I tap on it, the next view with the options doesn't load, nothing happens when I tap the row, apart from the changing background colour of the cell.

Please help! Cheers.

Add Image field type

For filling UIImage properties, using UIImagePickerController for selection.

Yay or Nay? If welcome I'll try a PR soon

Enum NSInteger Bug

Changing the gender definition in the basic example to

typedef NS_ENUM(NSInteger, Gender)
{
    GenderMale = 10,
    GenderFemale,
    GenderOther
};

does not change the output after submitting the form. (gender is still 0 if male is selected).

I think theres something wrong with the enum handling.

Allow keyboard selection

I want to use decimal keyboard for number inputs but I can not force the keyboard I want.

Thanks!

Reload the form from within the form

As you say in your ReadMe, I've used a custom setter to intercept a value change within the form. I then use this value to recalculate another value within the same form. How can I now update this form? I've tried calling the 'Fields' method but this doesn't update the data visibly. I know it has been changed because if I scroll the cell out of view and then back the value is changed correctly. But I somehow need to reload the tableview from within the form, do you have an idea how to do this?

Keyboard Show and table content inset

On a very simply form I have 3 fields, the second is for date selection. When I select it, the table content moves upwards when there's no need to. It works fine with the normal keyboard/text fields, just not the date picker.

Form Validation

Are there any plans to include form/field validation as a feature for FXForms?

Crash when Canceling for with Object Picker visible

It appears that the delegates are not being cleared when deallocating the Form Objects so if they attempt to fire a delegate method, it results in a selector fired on a deallocated object.

I've fixed it here: boxer@5a4da60

(Sorry - too deep on the fork for a simple pull request and no time to make it work - there's more code to be written!)

Add field from FXFormViewController

I'm currently using FXForms to edit account details in an app I'm working on.
I would like to be able to programmatically add a button to the bottom of the table (to remove the account).
I don't want to have this field on all the FXForms I create using the same class, since the same form is also used for adding new accounts (and they can not be removed, obviously).

Any suggestions on how this can be done?

Get selected index when field type is numeric

Hi Nick,

with this issue I refer to the part of the documentation that states:

If the field type is numeric, and the options values are not numeric, it will be assumed that the field value should be set to the index of the selected item, instead of the value.

When I understand this correctly declaring a field as numeric like this and passing an array with some country strings would result in the property value being set to the selected index in the option table view (countryIndex is of type NSInteger)(?

@{ FXFormFieldKey : @"countryIndex", FXFormFieldTitle : NSLocalizedString(@"COUNTRY", nil), FXFormFieldOptions : self.countries },

However when I output the property value of countryIndex after I select an option and reload the table view I always get a value of 0. Also there is no checkmark set to the selected option in the table view listing the countries.

Do I misinterpret the documentation here?

Accessing cell properties without subclassing FXFormBaseCell

I wanted to be able to access basic cell properties without subclassing and I noticed that basically the field is mapped on the cell, hence this works:

         @"backgroundColor": [UIColor yellowColor],

So the dictionary becomes:

return @{FXFormFieldKey: @"email",
         FXFormFieldTitle: ICLocalizedString(@"FORM_EMAIL*", @""),
         FXFormFieldHeader: ICLocalizedString(@"FORM_ACCESS_DATA", @""),
         FXFormFieldPlaceholder: ICLocalizedString(@"FORM_EMAIL_PLACEHOLDER", @""),
         FXFormFieldType: FXFormFieldTypeEmail,
         @"backgroundColor": [UIColor yellowColor],
         @"textLabel.font": kFontNormal(14),
         @"textField.font": kFontNormal(14)};

Do you agree with this approach or you see anything wrong with it?

Coredata relation option picker

Not sure if this is there already, but can't seem to get it to work.

How to display and set another MO entity from a relationship.

For example on the Client Form which points to SalesAgent Entity. How to pick the Sales Agent (which has name, id, etc) display just name and then assign the selected SalesAgent MO to the Client form?

Example for Advanced method

Hi,

Really like FXForms, the idea and the implementation! thanks for sharing your code with us !

Um, also it would be awesome if you can make an example app using the advanced method !

Issues with showing MFMailComposeViewController

If I set a property to be MFMailComposeViewControler and the deploy device doesn't have a mail account configured, the form will show the "No Mail Accounts" alert view when the view appears, and then again before the cell is displayed. I've tried to set a default value for the property, but I can't get around it. Any advice?

Localization

Hi, does your framework have any support for localization? I think it would be awesome if for any field it would simply make the title of the field NSLocalizedString(fieldTitle, @"");
Then I wouldn't have to implement the 'Fields' method to get the titles localized.

Model not updating

This is relevant to #52: Is there a way to use a FXFormBaseCell subclass with a text field to update the model object?

Tableview doesn't reload when option is selected

Hi,

I currently have my own form view controller which conforms to the protocol
<FXFormControllerDelegate>. I've set it up as in the docs:

self.formController = [[FXFormController alloc] init];
self.formController.form = [[MKSignupFormInput alloc] init];
self.formController.tableView = self.tableView;

I've got a field in the form which allows user's to select their country:

@{
           FXFormFieldKey : @"country",
           FXFormFieldPlaceholder : @"Select your country...",
           FXFormFieldTitle : @"Country",
           FXFormFieldType : @"option",
           FXFormFieldOptions : [CountryPicker countryNames]
}

This field, when tapped, pushes a view controller to show these countries (non-custom). When I select an option, and then tap to go back to the form, the cell within the form is still set as selected, and the value does not get updated to be my selected option.

The workaround I currently use is to manually reload the tableview from my custom form view controller in viewWillAppear.

ceeK

Custom text field cell

I've tried to subclass FXFormTextFieldCell with little to no success. All I'd like to do is add an image view to the left of the cell, with a 58pt x-value. This is my attempt:

#import "FXForms.h"

@interface POnboardingCell : FXFormTextFieldCell

@property (strong, nonatomic) IBOutlet UIImageView *iconImageView;

@end
#import "POnboardingCell.h"

@interface POnboardingCell ()

@property (strong, nonatomic) IBOutlet UITextField *textField;

@end

@implementation POnboardingCell

@synthesize textField = _textField;

- (void)awakeFromNib {
    self.textField.frame = CGRectMake(58, 10, 254, 30);
    self.textField.textAlignment = NSTextAlignmentLeft;

    if (!self.textField.superview) {
        [self.contentView addSubview:self.textField];
    }

    self.iconImageView.backgroundColor = [UIColor greenColor];
}

@end

There is also a .xib file to accompany the class.

The view loads up, but I cannot interact with the text field.

Remove first section header

Hello,
How do I remove first section header (set its height to 0)?
Do I need to subclass entire formcontroller?

Thank you.

Placeholder not displayed using FXFormFieldTypeLongText

Hi,
first of all, great work! When I use "FXFormFieldType: FXFormFieldTypeLongText" property, placeholder is not shown.

Example:

  • Placeholder is not shown: @{FXFormFieldKey: @"citazione", FXFormFieldType: FXFormFieldTypeLongText,FXFormFieldPlaceholder: profilo.prfCitazionePreferita,
    @"textLabel.color": mainColor,
    @"textLabel.font": labelFont}
  • Placeholder is shown: @{FXFormFieldKey: @"citazione",FXFormFieldPlaceholder: profilo.prfCitazionePreferita,
    @"textLabel.color": mainColor,
    @"textLabel.font": labelFont}

Suggestions?

Best regards
Costantino

Proposal: Conditional/Dependent fields

Have you had any thoughts about how to structure Conditional and Dependent fields? I'm working through very specific use-case of replicating Apple's event creation form (EKEventEditViewController) for a custom calendar that cannot use EKEventStore. Problem here is the date-related fields:

First problem is the 'All day' UISwitch field. When enabled, it changes the 'Start' and 'End' field from DateTime to just a Date picker. So this would be a 'Dependent' field relationship to change that setting if value changes.

Second problem is the 'Repeat' field. It's currently a picker and if it equals anything other than 'Never' the form adds a 'End Repeat' field, which is also a picker (or poentially date). So this would be a 'Conditional' field that should only appear if another field's has a particular value or values (possibly using KVO?)

Again, this is very specific use-case, but I'm sure similiar concepts would be beneficial to more forms. Any thoughts on how to work these cases into FXForms? Happy to help contribute, just didn't want to do work one way if you have already considered and just haven't implemented yet.

How to Style Label for DatePicker & PickerView

Was trying to style the label for date picker and picker view but couldn't find a way for that. I've attach the screenshot that you can see the selected value font are different from the others.
screen shot 2014-04-04 at 5 53 45 pm

ReadOnly Mode

I need to use my FXForm also in ReadOnly mode. In this mode I set all the fields type as FXFormFieldTypeLabel, but I need also to hide all the empty fields (the hidden fields will be displayed in Edit mode).
All the fields are set via Fields method as UndefinedKeys, there aren't class properties.
Can you suggest me the best way to hide or show empty cells?

Thank you

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.