html-input

How to force Razor to make Editorfor to input number type for float variable?

本小妞迷上赌 提交于 2019-11-28 22:42:23
Here is my code in MVC 5: @Html.EditorFor(model => model.myfloatvalue, new { @type = "number", @min = "0", @step = "0.01", @value = "0" }) And here is the html code: <input class="text-box single-line" data-val="true" data-val-number="The field Fix Amount must be a number." data-val-required="The Fix Amount field is required." id="myfloatvalue" name="myfloatvalue" type="text" value=""> Not to <input class="text-box single-line" data-val="true" data-val-number="The field Fix Amount must be a number." data-val-required="The Fix Amount field is required." id="myfloatvalue" name="myfloatvalue"

Android browser refreshes page after selecting file via input element

99封情书 提交于 2019-11-28 19:10:20
I have a mobile web page which includes an input element of type 'file', to allow users to upload image files to a server. The page works fine on iOS, and on a Nexus 4 (Android 4.2.1) in the Chrome Browser. When I use a Samsung S3 (Android 4.0.4) with the default browser clicking on the 'Choose file' button opens the image selection dialog as expected, however after I choose an image and close the dialog the web page gets refreshed, so I lose the image that was selected. Has anyone else seen this behaviour? Any suggestions for a workaround? The input element that I'm using is fairly standard,

HTML Input cursor position issue in Chrome when value is empty

我的梦境 提交于 2019-11-28 18:12:43
Just recently I have noticed out text inputs having a display issue in Google Chrome but only when the text is empty. Notice how in the top image, when the input is empty, the cursor is too high within the text input. But once we type some text it corrects itself: JSFiddle to illustrate. May require Google Chrome version: 38.0.2125.101 m HTML: <input name="tb_password" type="password" id="tb_password" class=" validate[required,custom[password]]" placeholder="Type your password here" autocomplete="off" style=" margin: 0; line-height: 46px; "> CSS: input[type="text"], input[type="password"] {

ASP.NET MVC HTML helper methods for new HTML5 input types

∥☆過路亽.° 提交于 2019-11-28 18:08:33
HTML5 appears to support a new range of input fields for things such as : Numbers Email addresses Colors URLs Numeric range (via a slider) Dates Search boxes Has anyone implemented HtmlHelper extension methods for ASP.NET MVC that generates these yet? It's possible to do this using an overload that accepts htmlAttributes , such as: Html.TextBoxFor(model => model.Foo, new { type="number", min="0", max="100" }) But that's not as nice (or typesafe) as: Html.NumericInputFor(model => model.Foo, min:0, max:100) Paul Hiles Just a heads up that many of these are now incorporated into MVC4 by using the

How to stop buttons from staying depressed with Bootstrap 3

China☆狼群 提交于 2019-11-28 16:02:51
How do you make a button in Bootstrap 3 undepress automatically after being clicked? To replicate my problem, make a page with some buttons, give them appropriate bootstrap classes (and include bootstrap): <input id="one" type="button" class="btn btn-default" value="one"> <input id="two" type="button" class="btn btn-primary" value="two"> Load the page and click on one of the buttons. It becomes depressed and highlighted until you click somewhere else on the page (using FF29 and chrome35beta). Inspecting the input element while clicked and unclicked doesn't show any additional classes being

How to locate and insert a value in a text box (input) using Python Selenium?

大兔子大兔子 提交于 2019-11-28 15:31:06
问题 I have the following HTML structure and I am trying to use Selenium to enter a value of NUM : <div class="MY_HEADING_A"> <div class="TitleA">My title</div> <div class="Foobar"></div> <div class="PageFrame" area="W"> <span class="PageText">PAGE <input id="a1" type="txt" NUM="" /> of <span id="MAX"></span> </span> </div> Here is the code I have written: head = driver.find_element_by_class_name("MY_HEADING_A") frame_elem = head.find_element_by_class_name("PageText") # Following is a pseudo code.

CSS selector for text input fields?

不羁的心 提交于 2019-11-28 15:05:18
How can I target input fields of type 'text' using CSS selectors? input[type=text] or, to restrict to text inputs inside forms form input[type=text] or, to restrict further to a certain form, assuming it has id myForm #myForm input[type=text] Notice: This is not supported by IE6, so if you want to develop for IE6 either use IE7.js (as Yi Jiang suggested) or start adding classes to all your text inputs. Reference: http://www.w3.org/TR/CSS2/selector.html#attribute-selectors Because it is specified that default attribute values may not always be selectable with attribute selectors, one could try

How do I make a text input non-editable?

北战南征 提交于 2019-11-28 13:28:41
问题 So I have a text input <input type="text" value="3" class="field left"> Here is my CSS for it background:url("images/number-bg.png") no-repeat scroll 0 0 transparent; border:0 none; color:#FFFFFF; height:17px; margin:0 13px 0 0; text-align:center; width:17px; Is there a setting or a trick to this, I was thinking of doing a label instead but how about the styling. How do I convert them and is there a better way or is that the only way? 回答1: <input type="text" value="3" class="field left"

Javascript Validation for Positive Integer Only Input

那年仲夏 提交于 2019-11-28 13:04:19
问题 I have two text boxes, in it will only be allowed positive integers. If any alphabetical values or any other characters (e.g. %$&*£") are entered, an error message should be displayed and the values must not render a table. <input type="button" value="total" name="B3" onclick="powerOf();"> This line allows for calculation to be made, how can this validation stop this from happening when the incorrect values are entered?? As of now minus numbers are calculated and entering alphabets produces

HTML5 input type number vs tel

筅森魡賤 提交于 2019-11-28 11:57:26
I'm working on updating some form inputs to HTML5. I'm not interested in validating the data so much as having the numeric key pad on mobile devices. Input type 'tel' seems to do what I want, I get the numeric keypad on iPad/mobile. Input type 'number' will also give me the numeric keypad, but it also includes the spinner box which I don't want. What I want to know is if it's safe to use type="tel" on a credit card input? Or should I use type="number" and try to disable the spinner somehow. I was reading that disabling the spinner can crash Chrome which isn't a trade off I'm willing to make.