Combine HTML inputs? - html

HTML form
I am trying to combine:
<input name="domain" id="domain" required="" type="hidden" value="domain.com">
<input name="username" id="username" required="" type="text">
to pass this combined information in the form as what is now:
<input name="user" id="user" required="" type="text">
Current code:
<input name="user" id="user" required="" type="text">
This requires the user to type both the domain and user name into the text box.
Example: domain.com\username
I would like to include the static domain “domain.com\” as hidden text to the input so they can just type the username.
Example: username
The code currently is:
<p>Username:</p>
<input name="user" id="user" required="" type="text">

Related

why this pattern=”^re\-\d{6}$" not working properly in html

it's not giving me error message when I input different pattern, what did I do wrong ?
<label for="receipt">Receipt number *</label>
<input name="receipt" id="receipt"
placeholder="re-nnnnnn" required="required"
pattern="^re\-\d{6}$" />
It depends on what you want to achieve. For example, if your goal is re-123456, you should remove the first back-slash.
<form action="">
<label for="receipt">Receipt number *</label>
<input name="receipt" id="receipt" placeholder="re-nnnnnn" required="required" pattern="^re-\d{6}$" />
</form>

Trying to make a sign up form, but I get a error of Property 'address' does not exist on type 'SignupComponent'? And many more like it

I tried looking up at the issue but, it seems like I am doing it right?
So my HTML content shows that
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" [(ngModel)]="email" required>
<label for="username"><b>User Name</b></label>
<input type="text" placeholder="User Name" [(ngModel)]="username" required>
<label for="firstname"><b>First Name</b></label>
<input type="text" placeholder="Enter First Name" [(ngModel)]="firstname" required>
<label for="lastname"><b>Last Name</b></label>
<input type="text" placeholder="Enter Last Name" [(ngModel)]="lastname" required>
I have errors running through my HTML
Error occurs in the template of component SignupComponent.
and each of them says
Property 'lastname' does not exist on type 'SignupComponent'.

Required fields show the placeholder while non required fields do not

I have some required fields in my html code, but they do not show the place holder until I specify that the field is required. I do not know why...
<input class="text" type="password" name="password" placeholder="Enter new password" required="">
<br>
<input class="text" type="text" name="phone" placeholder="Enter new phone number">
The second input does not show the place holder when I run the code.

How to change the default message of the required field in the popover of form-control in bootstrap?

<form class="form-asd" role="form">
<h2 class="form-signin-heading">login</h2><hr />
<label class="control-label" for="username">Username</label>
<input class="form-control" type="email" required="" placeholder="username"data-error="enter username"></input>
<label class="control-label" for="username">password</label>
<input class="form-control" type="password" required=" " placeholder="Password"></input>
<label class="checkbox"></label>
<button class="btn btn-lg btn-primary " type="submit">submit</button>
</form>
how can we change this default message of popover of the require field "Please fill out this field "to "please enter username"
You can use setCustomValidity function when oninvalid event occurs.
Like below:-
<input class="form-control" type="email" required=""
placeholder="username" oninvalid="this.setCustomValidity('Please Enter valid email')">
</input>
Update:-
To clear the message once you start entering use oninput="setCustomValidity('') attribute to clear the message.
<input class="form-control" type="email" required="" placeholder="username"
oninvalid="this.setCustomValidity('Please Enter valid email')"
oninput="setCustomValidity('')"></input>
Combination of Mritunjay and Bartu's answers are full answer to this question. I copying the full example.
<input class="form-control" type="email" required="" placeholder="username"
oninvalid="this.setCustomValidity('Please Enter valid email')"
oninput="setCustomValidity('')"></input>
Here,
this.setCustomValidity('Please Enter valid email')" - Display the custom message on invalidated of the field
oninput="setCustomValidity('')" - Remove the invalidate message on validated filed.
And for all input and select:
$("input[required], select[required]").attr("oninvalid", "this.setCustomValidity('Required!')");
$("input[required], select[required]").attr("oninput", "setCustomValidity('')");
I wanted to change the text of the textarea. This method helped
<form action="/action_page.php" method="post">
<input type="text" required placeholder="username" oninvalid="this.setCustomValidity('Error validate')" oninput="setCustomValidity('')">
<br><br>
<textarea placeholder="Ko’cha, uy, xonadon" name="address" required oninvalid="this.setCustomValidity('Majburiy maydon')" oninput="setCustomValidity('')"></textarea>
<input type="submit" value="Submit">
</form>
$("input[required]").attr("oninvalid", "this.setCustomValidity('Say Somthing!')");
this work if you move to previous or next field by mouse, but by enter key, this is not work !!!

Generete Unique Id and pass into text field

I am new to php and would like some help on solving a problem I am having. I have a form that has 3 visible input fields, Name, Email address, phone number. Also it includes 3 hidden fields, one is a value set to 2500, the second is a currency, the third needs to be a unique ID. I need help on how to generate a unique id and pass the text/value into a input field in another form. Below is my code. I need the random id to be displayed on the input field merchantid. Thanks
<form action="https:urlthathastheform" method="post">
<input type="hidden" id="merchantid" name="merchantid" />
<input type="hidden" id="currency" name="currency" value="$" />
<label for="names">Names</label>
<input type="text" name="names" id="names" />
<label for="email_address">Email Address</label>
<input type="text" name="email_address" id="email_address" />
<label for="phone_number">Phone Number</label>
<input type="text" name="phone_number" id="phone_number" />
<label for="amount">Amount</label>
<input type="text" name="amount" value="2500" />
<input type="submit" name="submit" value="submit" />
</form>
php has a function to generate a unique id.
<input type="hidden" id="merchantid" name="merchantid" value="<?php echo uniqid();>"/>
Note, this id is based on the system clock. http://php.net/manual/en/function.uniqid.php