Skip to content
Advertisement

Category: Questions

Updating a rails record with vanilla javascript

Is it possible to update a rails record with vanilla javascript without intercepting the data and converting it to a hash in the controller? Here is my code: If I just send the data without stringifying it, it shows up in the rails controller at user: [object, object]. In the update action I update the params like this: params[“user”] =

How to disable a submit button until a radio button is selected (Javascript, HTML, and Flask)

I’ve seen other questions similar to this one, but I don’t know if my application isn’t working because I’m using a Flask/SQLAlchemy application (a truck scheduling application) or if there’s something else I’m missing. I want to disable the submit/update button until the user selects one of the materials to be picked up. update.html: Answer .getElementsByName() returns a node list

fetch() is spamming my API with thousands of requests

I have the following function which gets an image from my API: It did work, but now when I run the function it spams the API as the console gets flooded with “Fire” and my server gets thousands upon thousands of requests. Answer You named the function fetch so it overwrites (or shadows, depending on the scope your function is

Javascript Regex to match everything after 2nd hyphen

I’m trying to find a JavaScript regex pattern to match on everything after the 2nd instance of the hyphen – Here is an example: In this case, I’d like to only match the address so the desired variable to store would be: These characters 1 and H6205636 can change in length so I don’t think a pattern that matches on

Advertisement