I´m trying to fetch the values from a html drop down using a webview which is populated with a segmented controller.
Anyone know how to enter an
NSString *string [NSString stringWithFormat:#"document.getElementsBy
for the following html code and to select one of the option values
<div id="loginselect" style="clear:both:">
<select name="usertype" size="1" id="usertype" class="select1" >
<option value="0" selected="selected">Staff</option>
<option value="1" >Student</option>
<option value="2" >Parent</option>
document.getElementByID('usertype').value
The answer from sixthcent gave the right answer. I just had to add the value like this:
document.getElementById('usertype').value='1'
Related
Here is the code of an original dataList (select which has an option of customed typing):
<input type="text" list="selectCity" placeholder="select city" />
<data-list id="selectCity">
<option [value]="New York" />
<option [value]="London" />
<option [value]="Paris" />
<option [value]="Beijing" />
<option [value]="Montreal" />
</data-list>
I want to create something like this via <mat-select> .
I saw few questions about it, but the answers were something like- "you can make another input that accepts the customed value..",
but in my app I want to help the user to get the city easily among a very long list of cities. so that solution cannot help me.
I tried something with <mat-form-field> and <input> but that made some problems...
Can you give me any effective solution for this?
<mat-form-field appearance="fill">
<mat-label>select city</mat-label>
<mat-select>
<mat-option value="option">New York</mat-option>
<mat-option value="option">London</mat-option>
<mat-option value="option">Paris</mat-option>
</mat-select>
</mat-form-field>
In this example, you can type a letter, and reach to the first option that starts with that letter.
It will be helpful in case the options are sorted in alphabetical order.
Else, see here: https://material.angular.io/components/autocomplete/examples
I have a simple select like this:
<select [style]="{width : '100%' }" [(ngModel)]="rule.valoreImmesso" class="lm-custom-dropdown">
<option *ngFor="let valore of rule.comboValues" [value]="valore.value">{{valore.label}}</option>
</select>
I want to add an input text inside the dropdown in order to filter the options. Is it possible? How to do it?
You can do like this
<input type="text" list="cars" [(ngModel)]="rule.valoreImmesso"/>
<datalist id="cars">
<option *ngFor="let valore of rule.comboValues" [value]="valore.value"></option>
</datalist>
But datalist tag not supported in Safari So you must write a custom dropdown on your own. You can find some in the internet and modify them as you desired.
I'm programming my first mobile app using Icenium, PhoneGap and jQuery Mobile.
I have several select elements on different pages.
In Android it is working like expected. But in iOS and Icenium's iOS simulator, it is not. When you tap the element, you see in a fraction that it opens the options like a regular HTML option list and than it jumps immediately back to the previous page.
I have no errors and I don't know where to start to find the solution. I have search on Google, but no one does seem to have this kind of problem.
The html is looking like this:
<label class="cornerlogospan" for="ddlLanguage">Language</label>
<select class="settingselectfield" id="ddlLanguage" data-bind="value: Settings().UILanguage">
<option value="nl">Dutch</option>
<option value="fr">French</option>
<option value="en">English</option>
</select>
Generated html:
<label class="cornerlogospan">Language:</label>
<div class="ui-select">
<div id="ddlLanguage-button" class="ui-btn ui-icon-carat-d ui-btn-icon-right ui-corner-all ui-shadow">
<span class="settingselectfield">English</span>
<select class="settingselectfield" id="ddlLanguage" data-bind="value: Settings().UILanguage">
<option value="nl">Dutch</option>
<option value="fr">French</option>
<option value="en">English</option>
</select>
</div>
Edit
After the suggestion of Omar, I did add the data-native-menu="false" attribute. The page doesn't change anymore, but the page doesn't change anymore. http://www.youtube.com/watch?v=szVv2QfSH9M I still can't select a language. This is also the case in Android now.
I'm creating a web form using JQuery.
I want to copy previous select fields into another select field using a link. i have it changing the DOM, the value of select1.selectedIndex is changed. however it still visually displays the old value. apparently you need to refresh it so it visually updates. I don't understand the syntax of the refresh method i keep reading around. This is how I tried to do it and it doesn't work.
this is the html for the link
<select name="entry.14.single" id="entry_14">
<option value="1"></option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option></select>
<select name="entry.16.single" id="entry_16">
<option value=1""></option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option></select>
Same as above
here is my javascript:
function setSelect(id1, id2){
var select1 = document.getElementById(id1);
var select2 = document.getElementById(id2);
select1.selectedIndex = select2.selectedIndex;
$('#select1').selectmenu('refresh');
}
can someone please tell me why my refresh statement is not working?
p.s. i know there are other threads on the same issue, i have also read the 'documentation.' please dont link me somewhere else. I have read other sources and its not getting me anywhere. Please just show me what to change in order to get the refresh working properly.
EDIT: heres a jsfiddle you can mess around on
http://jsfiddle.net/AFzqt/7/
Utilize jQuery event handlers!
The function you are looking for is:
selectmenu("refresh")
In your example, it would look something like this:
$(function() {
$("#changeButton").on("click", function(e) {
$("#entry_16").val($("#entry_14").val());
$("#entry_16").selectmenu("refresh");
e.preventDefault();
});
});
http://jsfiddle.net/AFzqt/8/
I have 1 slider and 1 button:
<div data-role="fieldcontain">
<input type="range" name="slider" id="slider" value="0" min="0" max="100" />
</div><br><br>
<div data-role="fieldcontain">
<select name="slider" id="slider" data-role="slider">
<option value="off">Off</option>
<option value="on">On</option>
</select>
</div>
How can I POST (like form action="http://somesite" method="post"), when slider's value is changed? button is pressed?
One solution would be to add a custom data attribute that enables the input to auto submit the form it is child of.
Format of such an attribute could be:
<select name="slider" id="slider" data-role="slider" data-autosubmit="true">
<option value="off">Off</option>
<option value="on">On</option>
</select>
The jQuery code to enable auto submit is as easy as below, but we need to make it a bit more complicated for the slider, see the fiddle sample in the end for that.
$('[data-autosubmit="true"]').change(function(){
$(this).parents('form:first').submit();
});
I don't know if you use the native jQuery mobile form handling or a custom one, but if you want to use a custom hook on the submit it could look something like this:
$("form").submit(function() {
//Handle the submit with a jQuery.post or whatever
});
Here is a fiddle with some running sample code: http://jsfiddle.net/4VFgS/1/
The fiddle code got some handling to prevent that you submit the form 100 times per second.
$('#slider').change(function(){
...
$.post(yoururl, yourdata, function(callbackdata){
...
});
});
See jQuery.post() and jQuery.change()
Edit: BTW: Having 2 elements with the same id will likely lead to major problems sooner than later.
Edit 2: If you're trying to get a response from a different domain this way, you're probably out of luck unless they offer you JSONP or the like. You will not be able to fetch content from a 3rd party site via XMLHttpRequest because of Same Origin Policy Limitations.
You could proxy the request through your server, though, so the AJAX call would go to the same domain.