output for range not functioning live - html

I have a feeling this is an easy fix, but I can't seem to discover what I am doing wrong.
I have a range slider on a site I am developing (http://psalfa.azurewebsites.net/members/newquotesuppliersearch.aspx) that is tied to an output element to display the value of the slider.
I got the code from a jsFiddle and tested it there to ensure it worked, however now that its on the site, the output is not changing.
The code is below. Any help would be appreciated.
<form oninput="x.value=parseInt(a.value)">
<input type="range" name="a" id="a" value="50" min="50" max="2500">
<output name="x" id="x" for="a">50</output>
</form>

try: type="number" and add data-type="range"

Related

Adding a slider to html

I want to add a slider as in input on a web page I am designing. I don't even know if it is called a slider.
A "slider" is written like this but within <> tags:
<input type="range" min="5" max="10" step="0.01">
You can set step to 1 and set the minimum and maximum values however you want.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range
If you're looking for two sliders, you can build it out of two sliders like this:
<input value="500" min="500" max="50000" step="500" type="range">
<input value="50000" min="500" max="50000" step="500" type="range">
https://codepen.io/rendykstan/pen/VLqZGO

Site navigation using radio input

Short:
I would like to use input type radio in form as a site navigation tool without need of clicking on submit button. Is this possible?
Explanation:
I am using jQuery Mobile library for my GUI and I like how the look of radio input is automatically changed - In this look I want to classify people according to their names and to switch between pages in long output.
My current code i like this:
<form action="custmers.php" method="post">
<fieldset data-role="controlgroup" data-mini="true" data-type="horizontal">
<input type="radio" name="nav" id="a" value="customers.php?letter=a">
<label for="a">A</label>
:
:
<input type="radio" name="nav" id="z" value="customers.php?letter=z">
<label for="z">Z</label>
</fieldset>
</form>
But except of highlighting currently clicked option the page doesn't redirect.
This might work (haven't tested it)
Its still early in the morning... So there is a chance I'm still tired and not thinking properly. Haha
Change your form to
<form action="customers.php" id="navigation" method="get">
<fieldset data-role="controlgroup" data-mini="true" data-type="horizontal">
<input type="radio" name="letter" id="a" value="a">
<label for="a">A</label>
:
:
<input type="radio" name="letter" id="z" value="z">
<label for="z">Z</label>
</fieldset>
</form>
Then add some jquery to your scripts
$(function(){
var $navigation=$('#navigation');
$navigation.on('change','input[name=letter]',function(){
$navigation.submit();
// or to take a more complicated (read: unneccessary)
// window.location($navigation.attr('action')+'?letter='+$(this).val());
});
});
Do note: you should consider some validation in here. I wont bother mentioning security since you didnt post the rest of your script.

HTML5 Validation Not Trigering

I'm working on making client side validation for inputs.
I had had been using PHP to do it all.
Needless to say things got cluttered very quickly.
So I looked in to JS and HTML5 and want to move in to that system for validation.
The messages I want to show are like this:
I know that these are done with the the <input type="email"> tag.
After some help, I was pointed to this page html5rocks.
However I cant seem to get anything to popup.
I copied code straight from there site and nothing.
<input id="foo" type="number" max="2" value="1" />
<input id="bar" type="number" max="2" value="3" />
<script>
document.getElementById('foo').validity.rangeOverflow; //false
document.getElementById('bar').validity.rangeOverflow; //true
</script>
What am I missing to make the notification appear?
That popup is a new implementation in HTML5. Just create an input field like this:
<input type="email">
The popup appears automatically when the form is submitted if the input isn't an email-address.
More about the new input fields in HTML5 is at W3Schools.
Form must be submitted before validation kicks in.
So you have to add a button with the type of submit so like so:
<input type="submit" value="blah">
And then you have to enclose all the fields/inputs in a <form> and </form> tag.
here is the working code:
<form>
<input id="foo" type="number" max="2" value="1" />
<input id="bar" type="number" max="2" value="3" />
<input type="submit" value="blah">
</form>
<script>
document.getElementById('foo').validity.rangeOverflow; //false
document.getElementById('bar').validity.rangeOverflow; //true
</script>

Step parameter for input type of range

Is it possible to specify a decimal for a step parameter within the range element? According to a few articles I've read, including one on Nettuts, this should be possible. This does not appear to be working in any browsers. I've tried Chrome, Safari, and mobile Safari. Am I misunderstanding simple here, or is this just not supported quite yet?
<input id='something' type='range' min='0' max='20' step='.25' value='5' />
http://jsfiddle.net/Df57B/
Check out this demo it is possible to give steps in decimal.
<input type="range" name="points" min="1" max="10"
step="0.25" onchange="alert(this.value)"/>
Your mistake take is that you gave .25 instead of 0.25.
The following works for me in chrome, I'm thinking that it's the shortcut step=".25" that won't work
<input id="something" type="range" min="0" max="0" step ="0.25" value="5" />
If you want to make it work in Firefox 4+, you can use the following: HTML5Slider

sticky checkbox

Ii am trying to make a checkbox (to send via email) sticky.
To make sure it doesn't make a problem when sent empty I used the following:
<input type="checkbox" name="something" value="1">
<input type="hidden" name="something" value="0">
I have used things such as:
<input type="checkbox" name="something" value="1" <?=(($_POST['something']=='1')?'checked="checked"':'')?>>
But it does not work.
Can someone please help me? Many thanks Francesco
One could interpret that sticky means that user cannot uncheck the checkbox. That would be achieved using disabled="disabled" attribute.
As a side note, however, it wouldn't be very polite to force people to subscribe to some email list...
Do you mean checked?
If so then it would be
<input type="checkbox" name="something" value="1" checked="checked" />
Hope I understood that correctly