Select option is selecting the same value - html

I have a select option in the table, When i am selecting yes in html file, then it is selecting No value and If i am selecting No then also selecting No value, dont understand why this is happening. please help.
<tr>
<td> 24x7</td>
<td>
<select name="select10" id="Fvalue">
<option value="No">No</option>
<option value="Yes">Yes</option>
</select>
</td>
<td>
<input type="text" id="Gvalue" />
</td>
</tr>

Related

Two select options in different table cells don't work

So I have these <select><option>s which I put in two different table cells and no matter what the second one doesn't work the way it should. It kinda shows up as the select object on the page but I can't proceed any further actions (choose any option from the dropdown).
Code:
<table>
<tr>
//... other cells
<form action="./users.php" method="POST">
<td class="sex">
<select name="sex">
<option value="m">Male</option>
<option value="f">Female</option>
<option value="o">Other</option>
</select>
</td>
<td class="language">
<select name="language">
<option value="french">French</option>
<option value="german">German</option>
</select>
</td>
</form>
</tr>
</table>

How can I put an <input type="text" in a multiple <select>?

I´m using the code below to get an input textfield next to each option in a multiple select, but what I get is a total mess. The first option is in the multiple select but the rest shows out of the select list.
Does somebody knows how can I make that? I´m sorry I can not post images.
I hope somebody can help.
Thanks.
<select name="cars" multiple>
<option value="audi">Audi</option>
<input type="text" name="Audi" value""/>
<option value="bmv">BMV</option>
<input type="text" name="BMV" value""/>
<option value="honda">Honda</option>
<input type="text" name="honda" value""/>
<option value="peugueot">Peugueot</option>
<input type="text" name="peugueot" value""/>
<option value="volkswagen">Volkswagen</option>
<input type="text" name="volkswagen" value""/>
<option value="opel">Opel</option>
<input type="text" name="opel" value""/>
</select>
Do your drop down list but put a generic textbox afterwards. On the submit action, get the value of the count and apply it to the selected value.
<select name="cars" multiple>
<option value="audi">Audi</option>
<option value="bmv">BMV</option>
<option value="honda">Honda</option>
<option value="peugueot">Peugueot</option>
<option value="volkswagen">Volkswagen</option>
<option value="opel">Opel</option>
</select>
<input type="text" name="Count" value""/>
That only allows 1 count per save. If you want to be able to submit counts for ALL models, use a label and an input for each kind: like so
<table>
<tr>
<td>
Audi
</td>
<td>
<input type="text" name="audi" value""/>
</td>
</tr>
<option value="bmv">BMV</option>
<tr>
<td>
BWV
</td>
<td>
<input type="text" name="bmw" value""/>
</td>
</tr>
</table>

How to add tr or any html tag between two tr

Following is the html that I am using I want to add one tr between first two trs but it is not working.
I want to add a html tag and include class for first two tr. How can I achieve that? I do not want to include the submit button's tr in it.
<table cellspacing="0" id="content-space" class="content-space">
<tr>
<td>
Subscription Plan:
</td>
<td>
<select id="PlanNameId" style="width:auto !Important" name="data[][PlanNameId]">
<option value="4">
Disable
</option>
<option selected="selected" value="2">
Free
</option>
<option value="1">
Bronze
</option>
</select>
</td>
<td>
</td>
</tr>
<tr>
<td>
Auto Upgrade:
</td>
<td>
<select id="SubscriptionSetting" name="data[][SubscriptionSetting]">
<option value="1">
Yes
</option>
<option selected="selected" value="0">
No
</option>
</select>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="2" class="signin-button-containers">
<input type="submit" value="Submit" id="subscriptionsubmit" class="primaryLargeButton">
</td>
</tr>
You can simply get the first tr and then insert the new row right after it. With jQuery this is very easy, but without any libraries it can also be done without too much effort.
$("table tr").first().after("<tr><td>Inserted data</td><td>More data in between</td></tr>")
Example: http://jsfiddle.net/qnu3c0uk/1/
Given:
<table>
<tr>
<td>Text</td>
</tr>
<tr>
<td>Text 2</td>
</tr>
<table>
And that you want to insert a table row (with a cell) after the first table row i would do:
$("table tr:first-of-type").after($("<tr>").append("<td>"));
If you then want to add a class to the first and the new row, i would do:
$("table tr:eq(0),table tr:eq(1)").addClass("row-class");
Or actually combining the two parts to:
var $newRow = $("<tr>").addClass("new-class");
var $firstRow = $("table tr:first-of-type").addClass("new-class");
$firstRow.after($newRow.append("<td>"));

select tag in HTML

I am trying to achieve following using following code
<tr>
<td width="2%"/>
<td>[mc "Always Make List"]</td>
<td>
<select id="AML" NAME="ALWAYS_MAKE_LIST" style="margin-left:10px;" onchange="OnChange()">
<option value="Y">Y</option>
<option value="N">N</option>
</select>
</td>
</tr>
I am getting extra space in the dropdown list. I need to set default value of first element in dropdown to "Y"
Change the Y option line to <option value="Y" selected="selected">Y</option>
Set selected="selected" for the default option.
<option value="Y" selected="selected">Y</option>

2 combobox working together

I have two comboboxes:
Enable monitoring: Yes/No
and
Operation mode: Client/Server
The default value of the first one is 'No' and the second should be hidden. When I change it to Yes, I want the second combobox to be visible. How can I do that?
<tr>
<td width="25%" class="titulos" nowrap>Enable monitoring:</td>
<td width="75%" class="dados" nowrap>
<select class="dados" name="proxyconf" onchange="showOptions ();">
<option value="1" selected>No</option>
<option value="2" >Yes</option>
</select>
</td>
</tr>
<tr>
<td width="25%" class="titulos" nowrap>Operation Mode:</td>
<td width="75%" class="dados" nowrap>
<select class="dados" name="proxyconf" onchange="showOptions ();">
<option value="1" selected>No</option>
<option value="2" >Yes</option>
</select>
</td>
</tr>
You can do that with Javascript.
Give the second option box an ID, and then use Javascript to show/hide it:
<script type="text/javascript">
function showOptions() {
var elem = document.getElementById("id_of_second_box");
elem.style.display = "block";
}
</script>
You can pass in the option box to the function by reference if you like, and there are many different ways of showing/hiding elements using Javascript and CSS, but something along the lines of the above should help.
I would do it this way: http://jsfiddle.net/qtHc3/ (the example uses jQuery).
Using JavaScript:
function showOptions(elem){
if(elem.value == "2"){
document.getElementById("second").style.visibility = "visible";
}else{
document.getElementById("second").style.visibility = "hidden";
}
}
And the first combobox:
<select class="dados" name="proxyconf" onchange="showOptions(this);" id="first">
<option value="1" selected>No</option>
<option value="2" >Yes</option>
</select>
And the second one:
<select class="dados" name="proxyconf" onchange="" id="second" style="visibility:hidden">
<option value="1" selected>No</option>
<option value="2" >Yes</option>
</select>
But this may not be cross browser compatible so check carefully.