Onchange event of select box when using tab key - tabs

I have 2 select boxes called country and city. When i select a value from country box onchnage event is fired and cities will be loaded using an ajax request.
But when i use the tabs to navigate there are some issues.
Process.
Press tab key and get to country select box
press a key like 'M' to find values starting from 'M'
Then click tab again
The second tab click should focus the city box. But its not working only the 3rd tab click is focusing the city select box.
Do you have any idea of solving this??
Code
<label>Country * : </label>
<select tabindex="1" onchange="loadCities(this.options[this.selectedIndex].value,'url')" id="cmbDistric" name="cmbDistric">
<option value="0">Select</option>
<option value="1">Colombotest</option>
<option value="2">Colombotest</option>
<option value="3">Colombotest</option>
</select>
<label>City * : </label>
<select tabindex="6" >
<option value="0">Select</option>
</select>

This W3C document explains how to control the tabbing order. Basically, you can use tabindex to control the tabbing order. Here's the relevant part of their sample code, complete with unfortunate HTML 4-isms:
<FORM action="..." method="post">
<P>
<INPUT tabindex="1" type="text" name="field1">
<INPUT tabindex="2" type="text" name="field2">
<INPUT tabindex="3" type="submit" name="submit">
</P>
</FORM>
Similar information (without the HTML 4 sample code) is in the HTML5 draft.

Related

Why does the html input with type "text" is getting auto refresh everytime user is going to write on it

I'm having issues when trying to type in the input field of the HTML form is getting autorefresh as soon as I try to write on it, it is occurring just in phones link of the page: https://cheerful-cranachan-2e938c.netlify.app/?prefijos=%2B55&celular=12312#
I think most likely is regarding a slider interval of images I have on the page but I don't want to take it off.
<form action="#">
<label for="prefijos"></label>
<select name="prefijos" id="prefijos">
<option value="+57">+57</option>
<option value="+58">+58</option>
<option value="+55">+55</option>
<option value="+59">+59</option>
<input class="phone" type="text" name="celular" placeholder="Celular">
</select>
<button class="btn btn-form">Enviar</button>
</form>

Invalidate form if disabled select option is chosen

Is there a way to invalidate a form if value="0" in my select tag is chosen? The reason I did this is to have a default select option show up before a user see's anything.
But even if a user doesn't choose anything, the form is valid.
<form name="add_task_frm" ng-submit="!add_task_frm.$valid || functiontoUse()" novalidate>
<input type="text" ng-model="name" required />
<select ng-model="action" required>
<option value="0" selected disabled>Choose an Action</option>
<option value="description">See Description</option>
<option value="view">View</option>
</select>
<button type="submit">Submit</button>
</form>
I think you could just remove the value from the first option this should make it invalid if the user does not select anything. However I would recommend changing this implementation to use ng-options.
https://docs.angularjs.org/api/ng/directive/ngOptions

Form warning when page is refreshed -- despite no data entered?

I'm afraid I'm missing something basic about html/angular forms. I've created the following form. When I refresh, even if no user data is entered, I get a warning that I entered data into my page: "the page that you're looking for used information that you entered...".
I'm not worried about surpressing this prompt generally, but only when a user actually doesn't enter any data.
Thanks so much!
<form id="contactForm">
<input type="text" name="email" placeholder="not required"/>
<select class="form-control" name="category">
<option value="wrong">Wrong data</option>
<option value="feedback">Feedback</option>
<option value="inquiry">General Inquiries</option>
</select>
<textarea name="body" class="form-control" placeholder="Let us know how to improve"></textarea><br>
<input type="submit" ng-click="submit = 'true'" value="submit" /><br> <span ng-show="submit == 'true'" class="feedback">Thank you! We'll respond to your comments soon.</span>
</form>

Microsoft Edge browser history bug on input type radio and checkbox?

Microsoft Edge remembers the selected option of the select box but not which radio button I selected and which checkboxes I checked. All other browsers remember all settings.
edge1.html:
<form action="edge2.html">
<select name="S">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<select><br>
<input type="radio" name="XV" value="1"><br>
<input type="radio" name="XV" value="2"><br>
<input type="radio" name="XV" value="3"><br>
<input type="checkbox" name="C1" value="C1"><br>
<input type="checkbox" name="C2" value="C2"><br>
<input type="submit" value="submit">
</form>
edge2.html can be empty.
How can I tell the Microsoft Edge browser to remember the selected radio buttons and checkboxes and preselect them when I go back to this page?
Found an awnser on a microsoft form which says it is not supported at the moment
Hello Chris Rebert,
We sincerely appreciate your taking time to provide your feedback. Radio button and checkbox are not supported input types for oninput event on MS Edge.
Please see the following list for supported input types.
input type=" text, textarea, password, date, datetime, email, month, number, range, search, tel, time, url, week, color"
Additionally, you can file your suggestion at the uservoice site so others can review your suggestion and vote it up!
https://wpdev.uservoice.com/forums/257854-internet-explorer-platform.
Best Regards,
The Microsoft Edge Team
Another:
https://connect.microsoft.com/IE/feedback/details/1883692
There's a feedback item to support this feature which has over 100 votes at the moment:
https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/10182111--input-type-checkbox-type-radio-should-fire-in

How can I check every input element on an AngularJS page, visible or non-visible?

For instance, I have a page that has some forms that are directives. I would like to store every input element on the page into a variable, but some of these elements are hidden behind ng-if's.
How can I get these elements regardless of whether or not they are currently visible on the view? Currently I am using
var selects = document.getElementsByTagName('select');
This is ran on the directive that corresponds with the templateHTML below:
<div>
<label>Are you planning to attend a commencement ceremony at the Athens Campus? </label>
<select id="ceremony" name="ceremony" ng-model="gradCeremony" ng-options="option.value as option.name for option in options" required>
<option value="">Selection Required</option>
</select>
</div>
<div>
<label class="control-label" for="regional-ceremony">Are you planning to attend a recognition ceremony at one of the regional campuses?</label>
<select id="regional-ceremony" ng-model="regionalCeremony" ng-options="option.value as option.name for option in options">
</select>
</div>
<!-- This one is hidden by default -->
<div ng-if="regionalCeremony">
<label>Please indicate the regional campus</label>
<select id="regional-campus-ceremony" ng-model="regionalCeremonyCampus" ng-options="c.code as c.name for c in campuses" required>
<option value="">Selection Required</option>
</select>
</div>
As you can see, that last option is hidden behind an ng-if. It is not picked up in the array of inputs like I would like it to be.
This code is called with this in the html:
<form name="Form" commencement application="application" campuses="campuses" submitting="submitting"></form>