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

B

Brandon H.

Guest
Brandon H. Asks: 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:

Code:
<h3>Update Appointment:</h3><br>

<form action="/update/{{appt.id}}" method="POST">
    <label>Carrier:</label>
    <input type="text" name="carrier" id="carrier" 
        value="{{ appt.carrier }}"><br>

    <h4>Current material = {{ appt.material }}</h4>
    <label>Select a new material:</label><br>
    <input type="radio" name="material_update" id="HCl" value="HCl">
    <label for="HCl">HCl</label><br>

    <input type="radio" name="material_update" id="Caustic" value="Caustic">
    <label for="Caustic">Caustic</label><br>

    <input type="radio" name="material_update" id="Bleach" value="Bleach">
    <label for="Bleach">Bleach</label><br>

    <button type="submit" id="update_button" disabled>Update Appointment</button>
</form>

<script>
document.getElementsByName('material_update')
    .addEventListener('click', enable);

function enable() {
    document.querySelector('#update_button').disabled = False;
}
</script>

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.
 

Unreplied Threads

Suppose $G=\left\langle x, y, t|x^7=y^7=t^3=1, txt^{-1}=x^2, tyt^{-1}=y\right\rangle$. Show that $y\in Z(G)$.

Dick Grayson Asks: Suppose $G=\left\langle x, y, t|x^7=y^7=t^3=1, txt^{-1}=x^2, tyt^{-1}=y\right\rangle$. Show that $y\in Z(G)$.
The Problem: Suppose $G=\left\langle x, y, t|x^7=y^7=t^3=1, txt^{-1}=x^2, tyt^{-1}=y\right\rangle$. Show that $y\in Z(G)$.

My Attempt: Clearly $y$ commutes with $t$, so $y$ commutes with $t^2$ as well. Thus to show $y\in Z(G)$, it suffices to show that $y$ commutes with $x$. But I struggle to prove that $xy=yx$. It seems a rather silly place to get stuck-any HINT would be greatly appreciated.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

Inner and Outer Radius of a Set in Isotropic Position

user6952886 Asks: Inner and Outer Radius of a Set in Isotropic Position
For a compact convex set $C\in \mathbb{R}^d$ in isotropic position, a classical result in convex geometry says that there exists $r,R>0$ such that $B_2^d(r)\subseteq C \subseteq B_2^d(R)$ and $R/r \leq O(d)$.

Does the same remain true when the $\ell_2$ balls are replaced by $\ell_{\infty}$ balls? That is, does there exist $r,R>0$ such that $B_\infty^d(r)\subseteq C \subseteq B_\infty^d(R)$ and $R/r \leq O(d)$?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

Prove $e$ is irrational.

Julian Neira Asks: Prove $e$ is irrational.
I'm stucked in this problem: For every $n\in\mathbb{N}$, show that

$$0<e-\left(1+\frac{1}{1!}+\frac{1}{2!}+...+\frac{1}{n!}\right)<\frac{1}{n!n}$$ From this, prove $e$ is irrational.

I don't know how to prove $e-\left(1+\frac{1}{1!}+\frac{1}{2!}+...+\frac{1}{n!}\right)<\frac{1}{n!n}$. I already used induction, but it didn't work. Thanks for your help.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

What are the total number of state combinations for this dice game?

RTT Asks: What are the total number of state combinations for this dice game?
Lets say we have the dice game explained below. What are the total number of game states? In other words, how many numerical combinations of lives, totalScore, and scratchScore exist?

Initial State:

lives = 5, totalScore = 0, scratchScore = 0

The Rules:

Each turn you roll a 6-sided dice. If the roll is [1-5] then you add that score to your scratchScore. If you roll a 6, then your scratchScore is reset to 0 and you lose 1 life.

Before each roll, you may decided to yell "BANK" at which point you add your scratchScore to your totalScore and reset the scratchScore to 0. Everytime you yell "BANK" though you will lose 1 life.

If lives=0 you lose. Otherwise youc an win by achieving a totalScore that is >= 40. The idea is to only yell "BANK" when your scratchScore is somewhat large.

Here is an example game:

  1. lives = 5; total score = 0; scratch score = 0. You roll a 2 and do not yell ”bank.”
  2. lives = 5; total score = 0; scratch score = 2. You roll a 3 and do not yell ”bank.”
  3. lives = 5; total score = 0; scratch score = 5. You roll a 4 and yell ”bank.”
  4. lives = 4; total score = 9; scratch score = 0. You roll a 2 and do not yell ”bank.”
  5. lives = 4; total score = 9; scratch score = 2. You roll a 6.
  6. lives = 3; total score = 9; scratch score = 0
  7. ... repeat untill lives=0 or totalScore >= 40

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

Indefinite Integral of ${\tan(x)}^{p/q}$

Mailbox Asks: Indefinite Integral of ${\tan(x)}^{p/q}$
I have seen a lot of videos in which people integrate functions like $\sqrt{\tan(x)}$, $\sqrt[3]{\tan^2(x)}$, etc. I was wondering if there was a closed-form expression for $$\int (\tan{x})^{\frac{p}{q}} dx$$

Where $p,q$ are integers, and $q \neq 0$. Eventually, I would like to generalize the result to an integrand ${\tan(x)}^r$, for $r \in \mathbb{R}$, but for now we can stay with the rationals.

My attempt at solving this:

Let $u = \tan(x) \implies x = \arctan(u), dx = \frac{du}{1+u^2}$. This yields $$\int \frac{u^{\frac{p}{q}}}{1+u^2}du$$

But I'm not sure where to go from here. My first thought was long division, but that can't work here. I also considered treating $\frac{1}{1+u^2}$ like a geometric series, but that has a finite radius of convergence.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

How does a Phantom Rogue's Ghost Walk ability movement work?

  • Rykara
  • Social
  • Replies: 0
Rykara Asks: How does a Phantom Rogue's Ghost Walk ability movement work?
At level 13, the Phantom Rogue gets the ghost walk ability which grants (in part):

As a bonus action, you assume a spectral form. While in this form, you have a flying speed of 10 feet, you can hover [...]

Does this mean that the phantom rogue has (only) 10 feet of flying movement (and no other movement)?

Or does the phantom rogue gain 10ft of flying movement (in addition to their normal movement)?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

What do the spear and watermelon jokes in "Airplane!" mean?

  • freeling10
  • Social
  • Replies: 0
freeling10 Asks: What do the spear and watermelon jokes in "Airplane!" mean?
In the awesome 1980 comedy Airplane!, there are two jokes that make no sense and I've never been able to find an adequate explanation for them. Is anyone able to shed some light?

Near the end of the film, Rex Kramer (Robert Stack) arrives at the control tower to help Ted Striker (Robert Hays) land Trans-American Airlines' endangered flight 209. Kramer confers with Steve McCroskey (Lloyd Bridges) and, while they're discussing the situation, they have the following exchange:

McCroskey: Right now, things aren't so good.

Kramer: Let me tell you something, Steve. Ted Striker was a top notch squadron leader. A long time ago.

At that moment, a spear whizzes across the room and into a nearby bulletin board. Without referencing the projectile, the conversation continues:

McCroskey: I want you to get on the horn and talk that guy down. Now you're going to have to let him get the feel of that airplane on the way and you'll have to talk him onto the approach. So help me, you'll have to talk him right down to the ground.

At this point, a watermelon drops from above and smashes onto the corner of a desk in the background. It is not acknowledged by either character.

Everything else in the movie is crystal clear, but these two gags have always confounded me. Surely somebody must know!

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.