Alternative to html5 output tag? - html

I made a page using a form with few input "number". I used the html output tag to display the result. But in MSIE, the calculations were performed, but the output tag would not display them. Is there a simple workaround or alternative? It works if i use an input tag in place of the output tag, but then the result is displayed in a box which doesn't format very nice. (I thought the solution would be rather simple, like: (-"I have variableresult apples." - )

HTML 5 output tag is not supported on IE (or EDGE). So you are stuck with using input tag. You can, however, always use CSS to fix the layout of your screen.
If you want to support IE, you would have to go the old fashion way i.e. use JS with CSS

Output tag is not supported by MSIE or Edge according to W3Schools, a solution using Javascript can be found here. Additionally you can just use CSS to style the output-input as you wish.

I write a code might helps you, because I didn't clear with your question.
<form onsubmit="return false" oninput="o.value = parseInt(a.value) + parseInt(b.value)">
<input name="a" type="number" step="any"> +
<input name="b" type="number" step="any"> =
<output name="o"></output>
</form>
I made simple calculator.
OUTPUT tag will not support in IE.

Related

Spring form:input for number

I am using Spring's form:input as below :
<form:input type="number" .....>
in my jsp but when I check the html that is rendered on the browser it shows like :
type="number" type="text"
i.e., two type attributes are generated in the html.
On the other hand, if I check using inspect element option in the browser, it shows correct - only type="number" as expected.
Edit- My Question: Why am I getting two type attributes in generated html (type="number" type="text") ? How to get it resolved?
Spring form:input tag doesnt have any attribute named type and the type=number used in your code belongs to html5 input tag
Also have a look at HTML Text Input allow only Numeric input
Spring form tld lists the valid attributes of form:input element here
HTML 5
with <!DOCTYPE html> has native solution:
<input type="number">
Beware that it does not behave in standard way in some browsers.
Try input type="number" to see the HTML5 version in action.
See also https://github.com/jonstipe/number-polyfill for transparent support in older browsers.
I know this is old, but i found a solution that works just fine for me.
The spring:input form tag doesnt support the type attribute and there is no such thing as spring:number.
But you can use jquery to add the type="number" attribute to the parsed html.
I used:
$(".selector").attr({
"type" : "number",
});

How to set the language of the required fields feedbacks?

I would like to set up the message tip of a required field in html5
<html lang="en">
<input type="email" required="required" />
The message tip keeps on being labeled in french. I don't know which variable cause the browser to choose any language.
Isn't there a way to handle the html5 interaction languages smoothly (without JS)? I expected the langattr to be sufficient...
Had the same problem
Actually, you shoud use JS to achieve that. On another hand, you could recompile your browser from source and change manually texts that are not in your desired language if you absolutely do not want to use JS.
Yes, you should use
setCustomValidity("Votre Custom Mensaje Naturlish");
whithin an oninvalid handler function attached to the input element.
Something like:
<input type="email" oninvalid="handlerToCall(this)" required="required" />
Here you'll find answers that are valid and do work for what you want to do.
Try the jsfiddle live examples and you'll see for yourself :)

Applying padding to <input type="file" not working in Mozilla 12.0

This is bugging me ... I have a simple HTML page that has a file typed input HTML object - see the line of code below:
<table>
<tr><td><input type="file" id="file" name="file" class="textbox" size="75" /></td></td>
</table>
In my CSS file I have:
input.textbox{padding:10px;font-size:14px}
The padding works fine in IE9 but does not appear to work in Mozilla. Are there any considerations that I need to take into account with Mozilla?
Any help would be greatly appreciated.
Thanks!
Set padding on the enclosing td element instead. File input widgets are implemented in special and varying ways in browsers, and they may be partly immune to CSS.
The best solution I've seen is here: http://www.quirksmode.org/dom/inputfile.html. Style for file inputs are notoriously inconsistent across browsers, so it requires a bit of hack-work on the HTML.

Why is Chrome showing a "Please Fill Out this Field" tooltip on empty fields?

I was contacted by my client saying that users complaint saying that some fields now show a tooltip with a message "Please Fill out This Field". I couldn't believe what I heard... but the client is right - using latest Chrome version some fields show a browser tooltip with this message even side by side with my validators!
What's the problem? What am I missing?
Thanks.
EDIT:
The HTML generated by my user control is as follows:
<input name="tbMontante" type="text" maxlength="8" size="10" tbMontante" class="Montantetextfield"
FieldName="Montante"
Required="True"
AllowDecimalValues="True"
/>
EDIT:
My doctype is as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Should my browser use HTML 5 to parse it?
Are you using the HTML5 required attribute?
That will cause Chrome 10 to display a balloon prompting the user to fill out the field.
https://www.w3.org/TR/html5/sec-forms.html#element-attrdef-form-novalidate
You can disable the validation in the form.
Put novalidate="novalidate" on <form> tag.
<form novalidate="novalidate">
...
</form>
In XHTML, attribute minimization is forbidden, and the novalidate
attribute must be defined as <form novalidate="novalidate">.
http://www.w3schools.com/tags/att_form_novalidate.asp
To stop that Html5 popup/balloon in Web-kit browser use following CSS
::-webkit-validation-bubble-message { display: none; }
As I mentioned in your other question:
The problem to do with that fact, that you invented your own non-standard attributes (which you shouldn't have done in the first place), and now new standardized attributes (or attributes in the process of being standardized) are colliding with them.
The proper solution is to completely remove your invented attributes and replace them with
something sensible, for example classes (class="Montantetextfield fieldname-Montante required allow-decimal-values"), or store them in JavaScript:
var validationData = {
"Montante": {fieldname: "Montante", required: true, allowDecimalValues: true}
}
If the proper solution isn't viable, you'll have to rename them. In that case you should use the prefix data-... because that is reserved by HTML5 for such purposes, and it's less likely to collide with something - but it still could, so you should seriously consider the first solution - even it is more work to change.
You need to add the attribute "formnovalidate" to the control that is triggering the browser validation, e.g.:
<input type="image" id="fblogin" formnovalidate src="/images/facebook_connect.png">
If you have an html form containing one or more fields with "required" attributes, Chrome (on last versions) will validate these fields before submitting the form and, if they are not filled, some tooltips will be shown to the users to help them getting the form submitted (I.e. "please fill out this field").
To avoid this browser built-in validation in forms you can use "novalidate" attribute on your form tag.
This form won't be validated by browser:
<form id="form-id" novalidate>
<input id="input-id" type="text" required>
<input id="submit-button" type="submit">
</form>
In Chrome (v.56 is what I'm using but I AFAIK this applies generally) you can set title=" " (a single space) and the automatic title text will be overridden and nothing displayed. (If you try to make it just an empty string, though, it will treat it as if it isn't set and add that automatic tooltip text you've been getting).
I haven't tested this in other browsers, because I found it whilst making a Google Chrome Extension. I'm sure once I port things to other browsers, though, I'll see if it works in them (if even necessary), too.
Hey, we just did a global find-replace, changing Required=" to jRequired=". Then you just change it in the jquery code as well (jquery_helper.js -> Function ValidateControls). Now our validation continues as before and Chrome leaves us alone! :)

changing the name of type="file" input tag?

i have an input tag...
<input type="file" name="upload">
for browsing it makes the button vith value "browse"(in mozilla)
the question is: how can i change the name of that button? i want it to have the name "select" instead of "browse".
Thanks
Unfortunately the button text of an <input type="file"> is controlled by the browser, and cannot be changed, as far as I know.
In general, fancy file uploaders are often flash-based. However, if you are ready for a challenge, you may want to check out the following QuirksMode article for a few CSS + JavaScript tricks in this direction:
QuirksMode: Styling an input type="file"
I haven't tried, but can you set the input to display:none and then use background images?