Code Monkey home page Code Monkey logo

Comments (3)

ziazek avatar ziazek commented on July 30, 2024

Update:
I tried a "regular" form:

{{ f = form_for @changeset, "#", [phx_change: :validate, phx_submit: :save] }}
  {{ label f, :surname }}
  {{ text_input f, :surname }}
  {{ error_tag f, :surname }}

  {{ label f, :given_name }}
  {{ text_input f, :given_name }}
  {{ error_tag f, :given_name }}

  {{ label f, :email }}
  {{ text_input f, :email }}
  {{ error_tag f, :email }}

  {{ submit "Save" }}
<#Raw></form></#Raw>

(1) remains - clicking the browser Back button doesn't work. It's probably an issue with LV and not Surface.

I see the following in the console (LiveView debugger), which seems to indicate the new content was pushed to the browser, but the DOM was not replaced.
image

For (2),

  • Using the "regular" form, after navigating using the browser Back button to /home then back to /form again, the "validate" event does fire.
  • I found a workaround that works with the Surface component - use push_redirect(socket, to: "/home") to navigate back instead of using the browser Back button.

However, this won't prevent users from using the Back button.

from surface.

ziazek avatar ziazek commented on July 30, 2024

Update: I managed to fix it.

It was due to a layout declaration in my LiveView. Once I removed it, the bugs went away.

defmodule AppWeb.StepperLive do
  use Surface.LiveView, layout: {AppWeb.LayoutView, "live.html"} 
  # Don't put layout here, do it in router
  # ...
end

Closing this issue.

from surface.

msaraiva avatar msaraiva commented on July 30, 2024

@ziazek I'm glad to know you've fixed.

Cheers.

from surface.

Related Issues (20)

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.