morteza
Hey
when i use --no-brunch ,delete method does not work in front end ,why phoenix force me to use brunch or some things like that ? if i dont want to use brunch or webpack and … what should i do for working delete method in front end ?
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
I’ve followed the Phoenix LiveView file upload code here Uploads — Phoenix LiveView v1.0.0-rc.7 and so far everything works just fine wit...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Latest Phoenix Threads
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #iex
- #elixirconf-us
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
lpil
The browser does not natively support delete requests so for them to work you will need to include the Phoenix HTML Javascript file (phoenix_html/priv/static/phoenix_html.js at main · phoenixframework/phoenix_html · GitHub)
In removing brunch you will have also removed the mechanism through which this file was added previously. Load it on the page through a method of your choice and delete link will work again.
OvermindDL1
Except you can set the delete method in the form, you don’t need javascript at all. What the javascript is used for is the ‘are you sure’ question of it, which you can leave out if you don’t need it and/or want to get rid of javascript (you can emulate it well enough via CSS and DOM nodes anyway as I’ve done at work).
abitdodgy
What if you are submitting the form via a link, though? For example, a link that triggers a delete request? I think then you would still need the JS.
OvermindDL1
As per the HTML5 standards, raw links only method is GET (never PUT/POST/DELETE/etc… though they can potentially cause a HEAD or OPTION request), and raw links should not make effectful changes into a system, only forms should cause effectful changes.
morteza
thank you for response,can you explain this ? i am new to the web programming specially in front end
OvermindDL1
The phoenix_html ‘delete’ button function actually just makes a form that does nothing when clicked, it instead delegates the functionality to javascript to cause a popup box to ask if you are sure you want to delete it and if the user clicks Ok then it sends the command. I really don’t like that pattern as then it won’t work when I’m in, for example, elinks (as I often am), so they just don’t work for me. Using a proper form with just CSS to fix it up and ask a question on first expansion is far more reliable and ‘safe’.
morteza
if possible send me example about this , i dont like to use or see magic codes in my program and the delete link which generated by phoenix confuses me
or show me a way to dont use the phoenix_html.js
OvermindDL1
This is my delete button that I use:
And if I want an ‘are you sure’ kind of thing then I instead just put it inside a pure CSS collapsible element that I use here with the title of it as something like ‘Dangerous options’ or whatever and the delete button inside of it, so it first has to be expanded then the delete button can be clicked or so.
morteza
thank you bro

OvermindDL1
Just for clarity, this is the important bit of it. It is a form with the action being the path to delete to, the method is ‘post’ (just because browsers don’t support non get/post methods very well), but then you override the method with the hidden input named
_methodwith it’s value set todelete, and of course a CSRF token as all good forms should have, and the button to actually submit the delete form request.