Hi there wonderful people of Stackoverflow. So I am currently setting up a form for users to add data to the database. One of the the form-elements being a textbox where the value should be "nn minutes". I want the user to be able to edit the nn however the minutes should always append to the users input. How do I go about solving this?
You can try following:
<form>
Select minutes spent:
<input type="number" name="quantity" min="00"><span> minutes</span>
<br><input type="submit" value="Submit form">
</form>
Note type="number" not supported in IE9-
Depending on your front end framework, you can use some masked input plugins to do that.
And if you are not using, jQuery it's a good one to begin.
Related
As you know, the <input type="text" name = "input_field"> element creates a space for the user to type in an HTML form. But in this case, I know what the user is going to enter.
For instance, the user wants to send 'hello' to the action page. It isn't a particular piece of information like his/her name, email id, etc. It will be the same for everyone. Then why not just create a button like this:
<input type="submit" value="click to send 'hello'">
When the user will click on the button, 'hello' will be sent to the action page specified in the action attribute of the <form> element.
How do I do it? Also, I need to mention that I am not much experienced in HTML or JS, so I would appreciate a beginner-like solution.
I apologize if this question already exists somewhere.
Thanks in advance!
You can include predefined information when submitting a form by using a type="hidden" field:
<input type="hidden" name="input_field" value="hello">
That doesn't appear visibly on the page, but is submitted just like any other field when you submit the form.
As far as I understand your problem, you want to create a form where few fields will have predefined information
I would suggest not to hide the input according to the UI/UX perspective but instead, you can show those fields as read-only.
In this way, the user will have an idea of predefined values
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<input type="number" disabled readonly id="custId" name="custId" value="3487">
<input type="submit" value="Submit">
</form>
I am trying to create a customer contact update form in NetSuite. How can I do this without using <NLFORM> tags? I want to use the normal HTML input tags. Can anyone help me achieve this.
You can just go ahead and do that. I have seen examples of people who have hacked the online form code so that they can create their own form (e.g. create an online custom form and make note of all the hidden form fields and action url. Then use those in your own form values.
<label>First name</label><input id="445" name="custrecord12" type="text"><br>
<label>Last name</label><input id="446" name="custrecord13" type="text"><br>
</div><br>
<input type="submit" value="submit">
I want the user to be able to change the name of a list/table
<div class="col-md-6">
<form method="post">
<h1>
<b>
<input type="text" value="Group" id="groupName">
</b>
</h1>
<input type="submit" value="Change Name">
</form>
</div>
https://jsfiddle.net/bqgqhxs2/
i only put up the bare minimum code to hopefully get my point across.
i have a "hidden" text box and a submit button and i want the value that the user inputs into the text box to become the new value preferably without having to reload the page.
how would i go about implementing that? or is what I'm asking for even possible?
also if anyone has any other suggestions for a "rename" feature I'm all ears, the overall project is going to be implemented into meteor so if someone has a meteor solution that would be great but I'm only worrying about one problem at a time.
You can use the blur method to take the new name typed into the input.
$("#groupName").on( "blur", function() {
//change the id here
$("table").attr("id", $(this).val() )
//or the value of an element
$("table").attr("value", $(this).val() )
})
No need for the button to change the name of the table
fiddle https://jsfiddle.net/bqgqhxs2/2/
This seems to be a simple problem - However I just can't get my head around it!
So basically what the issue is, is that when a customer enters a "Payment amount" on my website I am trying to convert their input into something like this...
CUSTOMER INPUTS SOMETHING LIKE THIS:
£175.98
I want it to be converted to something like this: 175.98
Or if the customer enters 19803
I want to be able to append the decimal and comma places and remove any invalid characters like so:
19,803.00
I have searched and searched the internet for about 2 days and can't find anything like this!
Sorry I haven't provided any code but I figured if i can't find anything like this I'm sure that others will have the same issue.
Form I am using:
<form action="https://myaccount.mysite.com/s/customer/payment/new-payment/action.do" method="post">
<input type="text" name="pamt" id="payment_amount" />
<input type="submit" value="Continue to PayPal" />
</form>
You should try out numeral.js. I have used it for similar formatting tasks in the past.
http://numeraljs.com/
For example:
var string = numeral(1000).format('0,0.00');
So, then you could use the onblur event to change the value to what you would like it to be:
<form action="https://myaccount.mysite.com/s/customer/payment/new-payment/action.do" method="post">
<input type="text" name="pamt" id="payment_amount" onblur="try{this.value = numeral(this.value).format('0,0.00') }catch(e){};" />
<input type="submit" value="Continue to PayPal" />
</form>
UPDATE
It appears there is a bug in the following version of numeral.js
<script src="//cdnjs.cloudflare.com/ajax/libs/numeral.js/1.4.5/numeral.min.js"></script>
However, I had full success using the version titled numeral.js that can be downloaded here:
https://github.com/adamwdraper/Numeral-js/zipball/master
I just creating a booking system and I want that the users will choose a date from the calender and it'll show in input text - that I did!
Now I want to block the writing in the input text (just bring to calender writes there when the user choose a date).
How do I do it? I guess JavaScript, but how? I dont know JS very wall..
Thank you very much!
Give your element the readonly attribute, this will disallow users to type anything into it. However, you will still be able to write to add through javascript for example when a date is chosen. Here is an example:
<input type="text" id="txt" readonly="readonly">
JavaScript:
var el = document.getElementById('txt');
el.value = "Testing......";
Working Demo
<input type="text" id="someId" disabled="disabled" />
The disabled property will prevent any user input, but you can still write to it via your javascript calendar method.
For those who wants to prevent typing but not having the disabled style, can try:
<input type="text" onkeypress="return false;"/>