Giter VIP home page Giter VIP logo

form-builder's People

Contributors

fusion-industries avatar joykangangi avatar linusmuema avatar sergeimikhailovskii avatar surensth 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

form-builder's Issues

Credit card validation

In the current project, we're using regex to validate credit cards. This method is not preferred since the regex is very long and banks keep on changing the numbers. This means that we will need to keep on changing the regex to accommodate new card numbers. More info in this solution

Solution:

We can make use the Luhn Algorithm which is commonly used to verify Credit cards. Check this article for more information.

How do I prepopulate with existing data

If I have an update form that I wish to prepopulate with data which method should be called. Or is there a need to create the setData equivalent of getData on FormState?

Custom regex validation

Hello, I'm a bit confused on how to use the Custom validator since I couldn't find examples where it is used.
For example, if I have a regex string and want to add a Validators.Custom to a TextFieldState that checks whether the content of a TextField matches it, how should I do that?
Thank you!

How to validate the same password for password and confirmation fields?

Hi,

Can you you show how to validate the password and confirmation fields? I do have

private var passwordConfirmation = mutableStateOf("")


Validators.Custom("Password given must be the same") { password ->
                        password.toString() == passwordConfirmation.value
                    }

And I do have the above in the password TextField and I am trying to capture the confirmation in

TextFieldState(
                name = "password_confirmation",
                validators = listOf(Validators.Required(),
                    Validators.Min(8, "Password must be 8 to 16 characters"),
                    Validators.Max(16,"Password must be 8 to 16 characters"),
                    Validators.Custom("Password given must be the same") { confirmation ->
                        passwordConfirmation.value = confirmation.toString()
                        true
                    }
                )
            )

But this does not work. Thanks for your help.

Add validation for dropdown menu

This library is awesome, can we validate dropdown menu (spinner) with form_builder? If it is possible than show us how to implement it or if it is not possible than please add this validation too. thnx.

Validators

Just as the README states, we will need various functions specified in the library for validations.

You can start by creating an open class to define your validators:

sealed interface Validators
open class Email(var message: String): Validators
open class Required(var message: String): Validators
open class Min(var message: String, var limit: Double): Validators
open class Max(var message: String, var limit: Double): Validators
open class Regex(var message: String, var regex: String): Validators

Then in the state class, you can add the actual implementation of the validator:

private fun required(): Boolean = text.isNotEmpty()

In case of any question, you can reach out to me or check this repo for further guidance.

Survey validation

TO-DOs

  • Implement the validate on each screen flow
  • Add the individual form validations
  • Implement the whole survey validation
  • Navigate to the error screens if needed

Nice to have's

  • Animate the navigation to the error screens

More validations

Here's a list of more validations that we can add to our already existing validations list.

  1. Phone: this can be used to verify phone numbers. From the android util patterns, we can verify this data just like we do with emails.
  2. Web URL: this can be used to verify links. Simply that. Same case as the phone, we have android utils.
  3. Cards: We can use this to verify credit card numbers.

Form inputs

These are the individual fields in the survey components.

TO-DOs

  • Implement three composables to hold the different form input groups
  • Handle the state changes and updates for each of the input fields

Intro & Exit screens

TO-DOs

  • Create the Intro screen and its components
  • Create the Exit screen and its components
  • Handle navigation in each screen

Nice to Haves

  • Animate the start button using a pulse animation
  • Animate the navigation transitions

Broken Logic on Select State

The SelectState is broken on the app. It doesn't update the values when I click a new value on the checkbox

device-2022-07-22-172359.webm

Tab layout

This includes the indicator at the top of the screen.

TO-DO's

  • Create the TabLayout composable
  • Implement the state changes and update the UI on navigation

Nice to have's

  • Animate the visibility on navigation
  • Animate the transition on navigation

Survey state management

In the SurveyViewmodel class, create a the form states to hold the states of all the fields of a single page the survey. All fields must have the Validators.Required validator.

TO-DO's

  • Create the different form states
  • Add field states to the specific form states
  • Add the respective validators in each of the field states

Navigation

This involves the buttons on each of the survey pages.

TO-DO's

  • Add the buttons composable
  • Implement navigation between the survey pages
  • Start validations if needed
  • Navigate to ExitActivity if needed

Form fields UI

This issue should hold the discussion on building the form UI.
Ask any question you have here. Once done, we will create a PR to merge the work

proguard leads to exception

java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at kotlin.reflect.jvm.internal.calls.CallerImpl$Constructor.call(CallerImpl.kt:41)
at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108)
at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:159)
at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:112)
at com.dsc.form_builder.FormState.getData(FormState.kt:37)

I have kept the entire form-builder unobfuscated and also kept the corresponding objects, but it still causes reflection exceptions.

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.