Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to change form dynamically depends from user choice? #11

Open
andrewSvsg opened this issue Apr 16, 2016 · 4 comments
Open

Comments

@andrewSvsg
Copy link

For example user switch On/Off some option and and new section with some content will occur/hide in the current table

@neoneye
Copy link
Owner

neoneye commented Apr 16, 2016

There is no way to do this, yet. However it can be implemented fairly easy.

First modify the FormBuilder class with the desired functions.

Next modify the FormViewController class and perhaps other classes.

@justdan0227
Copy link

Need this too so working on solution

@justdan0227
Copy link

justdan0227 commented Jul 20, 2021

so I tried to add: (removing a form item if segment 0 is selected in a segmentedControl

public func removeInnerItem(_ item: FormItem) {
        if let found = innerItems.firstIndex(where: {$0.elementIdentifier == item.elementIdentifier}) {
            innerItems.remove(at: found)
        }
            
    }

and added a elementIdentifier. However I can't get the form to reload like it would with tableview.reloadData()

instance.valueDidChangeBlock = {[weak self] (value: Int) in
            print (value)
            if value == 0 {
                self?.mainBuilder.removeInnerItem(self!.venueListFormItem)
                self?.mainBuilder.validateAndUpdateUI()
            }
        }

@neoneye
Copy link
Owner

neoneye commented Jul 21, 2021

The form cannot insert/remove fields dynamically. I can't recall why I said it was easy to make. I think nowadays it's non-trivial to code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants