html-input

Do the values in the accept attribute require a computer to know the mime types?

社会主义新天地 提交于 2020-01-06 08:48:29
问题 so I have a standard <input type="file" accept="..."/> where the accept, is a large list of different mime types. I already verify the filetypes on the server backend but I want to be sure I am not filtering out valid files on the clients UI. I realise older browsers will not filter files at all, this is fine. My concern is that a modern browser may not recognise a mime-type and filter out files that are actually valid. So my question is basically, how reliable is the 'accept' attribute? For

Open a color input with display:none via a label (webkit)

混江龙づ霸主 提交于 2020-01-01 16:58:35
问题 I want to hide an input element and trigger it with an associated label . Usually that's not a problem. I can simply set display:none on the input like this input { display: none; } <input id="upload" type="file" /> <label for="upload">Upload a file</label> For some reason in Chrome (Firefox works), this technique is not working for a color input - DEMO input { display: none; } <input id="colorPick" type="color" /> <label for="colorPick">Pick a color</label> Is this a webkit bug or is there a

When to use the required attribute vs the aria-required attribute for input elements?

大城市里の小女人 提交于 2020-01-01 07:37:28
问题 I'm trying to make a form accessible. Should I make my inputs have both required and aria-required attributes, or just one? <label for="textbox1">Input</label> <input id="textbox1" type="text" name="Text Box" required> Or like this? <label for="textbox1">Input</label> <input id="textbox1" type="text" name="Text Box" aria-required="true"> Or like this? <label for="textbox1">Input</label> <input id="textbox1" type="text" name="Text Box" aria-required="true" required> The article Accessible

Angular 4 - How to use currency pipe in input type

♀尐吖头ヾ 提交于 2020-01-01 04:59:40
问题 I have an HTML input: <input [(ngModel)]="item.value" name="inputField" type="text" /> I want to format its value and use an existing pipe: .... [(ngModel)]="item.value | currency:'USD':true" ..... Also I'm trying to use it the following way, but it's giving me desirable output for the first time and showing error while updating the field: <input type="text" [ngModel]="item.value | currency:'USD':true" (ngModelChange)="item.value=($event)"> The above code leads to following error. ERROR Error

Have a file input form upload when a user clicks “open”

喜夏-厌秋 提交于 2019-12-30 14:08:29
问题 I am wondering if this flow is possible: Click a button that says "Upload". It is styled very differently from the usual . It does not show the "No file selected" text. The usual file browser pops open. The user chooses a file to upload. They click the "open" button in the file browser. Upon clicking "open", the file browser is closed (like normal) and the file immediately begins uploading (unlike normal where it requires a submit). I detect when the file is finished uploading, and direct to

Have a file input form upload when a user clicks “open”

北慕城南 提交于 2019-12-30 14:08:11
问题 I am wondering if this flow is possible: Click a button that says "Upload". It is styled very differently from the usual . It does not show the "No file selected" text. The usual file browser pops open. The user chooses a file to upload. They click the "open" button in the file browser. Upon clicking "open", the file browser is closed (like normal) and the file immediately begins uploading (unlike normal where it requires a submit). I detect when the file is finished uploading, and direct to

Add a File (JS object) to input type=“file”

徘徊边缘 提交于 2019-12-29 09:26:10
问题 I need a way to add a File object to a file input field. Note that I do not want to set the value of the file field. (which is a security risk, ... I know that) I already have the file itself (and all its contents!) I'm creating the File object like this: canvas.toBlob(function(blob) { var file = new File([blob], 'file.png'); // and now I want to add MY File to the input here }); Please don't tell me about how to upload the File, I know about XMLHttpRequest Level 2. I want to upload the File

Samsung Galaxy Tablet does not allow entering floating point numbers to inputs with “number” type

荒凉一梦 提交于 2019-12-29 08:28:10
问题 Our client wants us to display numeric keyboard for an input field so basically I created a field like: <input type="number" name="quantity" step=".01" value="0.00" /> However, Galaxy Tablet erases "." and merges numbers before and after it, also disables "." in the keyboard. Is there another way to solve this issue or display numeric keyboard in input field when using type="text"? Note: I tried using pattern attribute (which works on iPhone). I tested this issue on various Android devices

Samsung Galaxy Tablet does not allow entering floating point numbers to inputs with “number” type

扶醉桌前 提交于 2019-12-29 08:28:09
问题 Our client wants us to display numeric keyboard for an input field so basically I created a field like: <input type="number" name="quantity" step=".01" value="0.00" /> However, Galaxy Tablet erases "." and merges numbers before and after it, also disables "." in the keyboard. Is there another way to solve this issue or display numeric keyboard in input field when using type="text"? Note: I tried using pattern attribute (which works on iPhone). I tested this issue on various Android devices

Fill input file form with JavaScript [duplicate]

倖福魔咒の 提交于 2019-12-28 04:30:26
问题 This question already has answers here : How to set file input value when dropping file on page? [duplicate] (1 answer) Dynamically set value of a file input [duplicate] (4 answers) How to set a value to a file input in HTML? (8 answers) Closed 6 years ago . Note: The answer(s) below reflect the state of legacy browsers in 2009. Now you can actually set the value of the file input element dynamically/programatically using JavaScript in 2017. See the answer in this question for details as well