Button and text HTML - html

Trying to create a button for an email input. I have made it a few times but cannot make it the correct way here is what i am trying to make.
I have tried a few ways I can get the button and input fields there but how can I get the button to register the text "Sign Up"
<div class="email">
<p> Join our mailing list!</p>
<label for="email">Enter your email:</label>
<input type="email" id="email" name="email"> Sign Up
</div>

Check out the documentation! You need to wrap the "Sign Up"-text around a <button>-Tag like so:
<button>Sign Up</button>

You can add this line.
<button type="submit">Sign Up</button>
And if you are willing to style the Sign up Button. you can use the following code
<button type="submit" class="signupbtn">Sign Up</button>

Related

How to submit different forms with same input

Im trying to implement the "i'm feeling lucky" functionality in a quite simple web. The thing is that at first, without this button, the query was properly done (i mean when doing a normal search). But, when i included the im feeling lucky button, the normal search stopped working and know even when you click on norma search it goes directly to the firs result. im new to HTML and still lost regarding forms. Note that i cant do it using js cause its for an assignment meant to be done only with HTML.
Thanks a lot for your help :D
Image
Advanced
<form action="https://www.google.com/search?">
<div><input type="text" name="q" id="search"></div>
<div>
<input type="submit" value="Google Search" id="button">
<form>
<input type="hidden" name="btnI" value="1">
<input type="submit" value="I'm feeling lucky" id="button">
</form>
</div>
</form>
In case that you need two buttons with one text field, perhaps a different approach would be useful. Use
<button type="submit" name="action" value="val1"></button>
and
<button type="submit" name="action" value="val2"></button>
but be careful with this one, since some browsers will upload value from the "value" attribute.
The other method is to use some PHP in your script, like this:
<input type="submit" name="update_button" value="Update" />
<input type="submit" name="delete_button" value="Delete" />
<?php
if (isset($_POST['update_button'])) {
//update button
} else if (isset($_POST['delete_button'])) {
//delete button
} else {
//no button was pressed
}
?>
Happy coding!
You cannot nest forms
You need two forms:
Image
Advanced
<form action="https://www.google.com/search?">
<div><input type="text" name="q" id="search"></div>
<div>
<input type="submit" value="Google Search" id="button">
<input type="hidden" name="btnI" value="1">
</div>
</form>
<form action="https://www.google.com/search?"><input type="hidden" name="q" value="I'm feeling lucky"><button>I'm feeling lucky</button></form>
A few notes:
you have a form tag nested inside the other which is wrong.
you have two submit button with same id.
Remove these issues and it will work as desired.
As I see it, you want to have window inside another window, both of which will have buttons? In that case, don't go form inside form, make it div inside div and in both of them, enter a form, here's and example:
<div id="div1">
<form action="https://www.google.com/search?">
<input type="text" name="q" id="search">
<input type="submit" value="Google Search" id="btn1" class="button">
</form>
<div id="div2">
<form action="https://www.google.com/search?">
<input type="text" name="q2" id="search">
<input type="submit" value="Google Search" id="btn2" class="button">
</form>
</div>
</div>

Why is this html pattern of input type="checkbox" lable for breaking the ngx-bootstrap modal dialog

icheck-bootstrap is a pure css checkboxes and radio buttons for Twitter bootstrap. This implies it will work with any of the frontend libraries. At least that's the way I figured it... And indeed, his use from the readme of his github page for the library :Link to icheck-bootstrap demo with docs Does work it just has a side effect that I can live with.
In at lease one place where I'm trying to use this library, the component is in a modal dialog that is used to login to the site. Below is the html template code for the component:
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" aria-hidden="true" (click)="hideModal()">
<span aria-hidden="true">×</span>
</button>
<h3 class="modal-title-site text-center"> Login to Rove </h3>
</div>
<form #f="ngForm" (ngSubmit)="onSubmit()">
<div class="modal-body">
<div class="form-group login-username">
<div>
<input name="log" id="login-user" class="form-control input" size="20"
[(ngModel)]="model.email" placeholder="Enter User Email" type="email">
</div>
</div>
<div class="form-group login-password">
<div>
<input name="Password" id="login-password" class="form-control input" size="20"
[(ngModel)]="model.password" placeholder="Password" type="password">
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<span class="checkbox login-remember">
<input name="rememberme" value="forever" checked="checked"
[(ngModel)]="model.rememberMe" type="checkbox">
<label for="rememberme">Remember Me</label>
</span>
</div>
</div>
<div>
<div>
<input name="submit" class="btn btn-block btn-lg btn-primary" value="LOGIN" type="submit">
</div>
</div>
</div>
</form>
<div class="modal-footer">
<p class="text-center">
Not here before? <a data-toggle="modal" data-dismiss="modal"
href="#ModalSignup">Sign Up.</a> <br>
Lost your password?
</p>
</div>
The code above is without the icheck-bootstrap implemented code. Below I have changed the key lines of code that will implement the checkbox as per the readme documention on the github site
<div class="icheck-success checkbox login-remember">
<input id="rememberme" value="forever" checked="checked"
[(ngModel)]="model.rememberMe" type="checkbox">
<label for="rememberme">Remember Me</label>
</div>
this code works as per the readme, unfortunately, after the dialog has been closed the modality of the modal dialog stays and the main page behind it will not allow any input from keyboard or mouse.
Note the input tag in the effective lines, I have change from the name attribute, to the id attribute. That seems wrong to me but, it is as the documentation suggests and, the only way it will completely work. If I do not change the attribute from name to id the checkbox changes to the correct style but it will not check to show a true state. In fact if I remove the icheck-success class from the class attribute of the above div line the behavior is identical and the component will still not take input after the dialog box has been closed if I use the id attribute instead of the name attribute.
I'm using Angular V9 and the dialog component that I am using is from the Valor Software ngx-bootstrap library and, as stated, it works perfectly when I code the html input tag with the name attribute. Does any know of a workaround or possibly what is happening here? the styling is what I want on the site but not at the cost of not having the login dialog effectively lock the site up after you login.
Thanks for any info that you may have on this issue.
I have fix the problem I was having. The first part of the problem was that I was not asking the right question. I have edited the question to ask it in a better way, I think.
I have fixed the problem with the html below:
<div class="icheck-success checkbox login-remember">
<input id="rememberme" name="rememberme" [(ngModel)]="model.rememberMe" type="checkbox">
<label for="rememberme">Remember Me</label>
</div>
it seems I had to have a name attribute in the input tag for some reason that I'm not clear about at all but, this is what I did to get the modal dialog to truly clear from the page after close.

Form valdiation email using button with link

I am trying to do something very simple using html, however I don't find an easy way to solve this, without onclick javascript events.
My code is like this:
<div class="email">
<input type="email" placeholder="Email">
</div>
<a href="validation.html">
<button class="subscription-button">Keep Me Posted!</button>
</a>
This is fairly simple.
Without the href="validation.html tag, I get an automated form validation,
notifying when '#' is missing and such.
However, when adding the link to the page, this validation is not checked, and it goes on to the next page.
How can I make it check the constraints without needing to write JS for that?
I tried this:
<form action=./validation.html>
<div class="email">
<input type="email" placeholder="Email">
</div>
<input type="submit" value="Keep Me Posted!" />
</form>
But the same result
Try using the form instead of link with a required attribute prevent empty data to auto validate the email type
<form action="validation.html">
<div class="email">
<input type="email" placeholder="Email" required>
</div>
<button type="submit" class="subscription-button">Keep Me Posted!</button>
</form>
I removed the slash from next to validation.html.
Try this:
<form action="validation.html">
<div class="email">
<input type="email" placeholder="Email" required>
</div>
<button type="submit" class="subscription-button">Keep Me Posted!</button>
</form>

Nested <form> linking to another .html file

Very new to html. I'm trying to create a "log in" page that has a button that links to another "sign up" html page. But I run into a problem, as I want my 3 buttons (log in, reset, sign up) to be on the same line.
The main form will link to the main website once logged in, while the "sign up" form button is supposed to send me to the sign-up.html page. If I make the forms separate, the "sign up" button will be in a new line, but if I make them nested, it will require me to fill the form.
Thanks!
<form>
<div>
<b> Email </b>
<input type="Email" placeholder="Enter Email" name="Email" required="">
<br><br>
<b>Password: </b>
<input type="Password" placeholder="Enter Password" name="Password" required="">
<br><br>
<input type="checkbox" unchecked="unchecked"> Remember me
<br><br>
</div>
<div>
<button type="submit">Log in</button>
<button type="Reset">Reset</button>
<form action="sign up.html">
<button>Sign Up</button>
</form>
</div>
</form>
Nested forms are forbidden in HTML. You should use a validator.
There is no need for the nested form to exist at all. You aren't collecting any data with it. Use a link instead. Apply CSS if you don't like the way it looks by default.

change default gumby style button

I am in a gumby project and use gumby's defalut style.
I've got a gumby button below:
Here is the code for it:
<div class="large primary btn"><input type="submit" name="submit" value="Enter now " id="register-submit" href="#entry"></input></div>
I am just wondering, how to style it to following style:
The problem is, "Enter Now" is the value of the button. Any idea of to achieve this?
Would like to keep this gumby style, but don't know how to change it.
Try this and let me know:
<div class="large primary btn">
<input type="submit" name="submit" value="Enter now " id="register-submit" href="#entry">
</input>
<P style="text-align:center;>To input your unique game card code on the next page</p>
</div>
If you want to use purely css to achive this you could use the after psuedo element like so:
.primary input:after{
content:'To input your unique game card code on the next page';
}
If you want to add the text in the HTML look at the anwer Joy_S gave.
<div class="large primary btn">
<button type="submit" name="submit"id="register-submit" href="#entry">
<b>Enter now</b><br/>
<span style="font-size:12px;">To do something</span>
</button>
</div>