Coder Social home page Coder Social logo

live_phone's People

Contributors

dependabot[bot] avatar jmillxyz avatar maxvw avatar nkezhaya avatar rodolfosilva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

live_phone's Issues

Test example with `form` and `render_submit`

Are there any example tests that show how to make live_phone work with a standard live view test, using the form and render_submit functions?

When I try to test I get an error:

 ** (ArgumentError) value for hidden "contact[phone]" must be one of [""], got: "+55 (11) 98123-1234"
 code: |> render_submit()

Formatting issue when using this library in a form

First of all, thanks a lot for putting this library together!

I couldn't find documentation on using this inside a Phoenix (Liveview) form. Still, I adapted the example to do it like this (I'm on Phoenix Liveview 0.18, so there is no longer the need to import the socket on a live component):

<%= live_component(LivePhone.Component, id: "dp_mobile_phone", form: f, field: :dp_mobile_phone, apply_format?: true, preferred: ["US", "GB", "CA"]) %>

That seems to work alright when the form is used for the first time:
Screenshot 2022-12-12 at 16 48 40

However, when I returned to the form for a second time, the country was set to the US again. I expect the country to be set based on the stored country code and not show the +31 (in this example) in the input field. Am I missing some initialization in the above code, or has this not come up before?

Screenshot 2022-12-12 at 16 48 54

Furthermore, would it make sense to be able to pass (optional) parameters for the CSS class on the component so I can easily make this phone field look the same as my other inputs?

Compatibility issue with latest Phoenix 1.7

Added this to a app and I receive the following message.
Also tried the suggestion of adding {:phoenix_html_helpers, "~> 1.0"}. But message doesn't change.

==> live_phone
Compiling 3 files (.ex)

== Compilation error in file lib/live_phone.ex ==
** (RuntimeError) use Phoenix.HTML is no longer supported in v4.0.

To keep compatibility with previous versions, add {:phoenix_html_helpers, "~> 1.0"} to your mix.exs deps
and then, instead of "use Phoenix.HTML", you might:

    import Phoenix.HTML
    import Phoenix.HTML.Form
    use PhoenixHTMLHelpers


    (phoenix_html 4.1.1) expanding macro: Phoenix.HTML.__using__/1
    lib/live_phone.ex:8: LivePhone (module)
    (elixir 1.16.2) expanding macro: Kernel.use/1
    lib/live_phone.ex:8: LivePhone (module)
could not compile dependency :live_phone, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile live_phone --force", update it with "mix deps.update live_phone" or clean it with "mix deps.clean live_phone"


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.