Jquery :: Hide Input Field If Dropdown Item Selected
May 24, 2010
I have a page as below, I hope the form only show Select option when loading, then the input date fields will be displayed if select event category, where are the errors?
Code:
<script src="/misc/jquery/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$.viewInput = { '0' : $([]),
//THIS IS THE NAME OF THE DIV WRAPPING THE HIDDEN FIELD
'1' : $('#1'),
};
$('#category_class').change(function() {
// HIDES THE INPUT FIELD IF ANOTHER DROPDOWN ITEM IS SELECTED ONCE THE HIDDEN FIELD IS LOADED
$.each($.viewInput, function() { this.hide(); });
// SHOWS THE INPUT FIELD ITEM IF SELECTED
//$.viewInput[$(this).val()].show();
}); });
</script>
<table cellpadding=4 cellspacing=1 width="650" border=0 class='list'>
<tr> <td class='caption'>
<form action="save.asp" name="pvt_spec" method="post">
<table border=0 cellpadding=4 cellspacing=0>
<div id="1"> <tr>
<td nowrap><font size=2 color="#ff0000"></font>Start Date</td> <td class='data'>
<input onClick="this.select()" tabindex="1" type="text" name="s_dt" value="2000/01/01" size="13" maxlength="13" STYLE='text-align=center;'>
</td> </tr> <tr>
<td nowrap><font size=2 color="#ff0000"></font>End Date</td> <td class='data'>
<input onClick="this.select()" tabindex="1" type="text" name="f_dt" value="2078/12/31" size="13" maxlength="13" STYLE='text-align=center;'>
</td> </tr> </div> <tr> <td>category</td> <td class='data'>
<select name="category_class" id="category_class" tabindex=1><option value="1">Base category</option><option value="2">Parent Event Category</option><option value="3">Son Event Category</option></select>
</td> </tr> </td> </tr> </table>
View 9 Replies
ADVERTISEMENT
Oct 1, 2010
refer to following link and you will see first item/option of the first dropdown is being displayed as selected value of other dropdowns. [URL]
View 1 Replies
View Related
Mar 16, 2009
hi..i need some ideas...I want to calculate student fees payment on my php page, but my coding here its not working. One more thing is when selected item click and its can display value of the item in other textbox(ex: if course Diploma Multimedia is selected, then the course fee is 19000 is display on txtCourseFee).I'm using java script for the calculation and save into mysql database. The code is here :
[Code]...
View 8 Replies
View Related
Mar 16, 2009
I want to calculate student fees payment on my php page, but my coding here its not working. One more thing is when selected item click and its can display value of the item in other textbox(ex: if course Diploma Multimedia is selected, then the course fee is 19000 is display on txtCourseFee).I'm using java script for the calculation and save into mysql database. The code is here :
<script language="JavaScript" type="text/javascript">
function CalculateFee (form)
{
var coursefee;
var payamaount = form.txtpayamount.value; (user input)
var balfee;
[Code]..
View 2 Replies
View Related
May 19, 2010
like for example i have text areas named upload1 and upload2when I click or add input on upload1 a drop down list below upload2 will not change, but when I add input on upload2 the dropdown will select "parts"
View 3 Replies
View Related
Jul 20, 2005
This is my form, i would like to default the select box to USA, and default
the text field to a name such as 'Sarah' and the hidden field to another
number like ??', when the user clicks on the check box, otherwise the
fields should be blank, the value of the select box dosnt matter much, only
that it defaults to USA, when the user checks it.
--
<form name="form1">
<input type="checkbox" name="checkbox" value="checkbox">
<select name="prefix">
<option value="off" selected>Select country
<option value="61">Australia
<option value="1">USA
<option value="58">Venezuela
</select>
<input type="text" name="name">
<input type="hidden" name="number">
</form>
--
View 3 Replies
View Related
Apr 24, 2010
ive been racking my brain looking for a code solution for this....im a html and css pro....and a javascript heres what im tryna do....i have a form...that has a <option> in it for 6 dropdown options.... in one of those possible options.. when SELECTED...i want the div layer that i currently have under it...to appear and i cant seem to figure it out....heres my code in its entirety i want budget div...to appear when the option website design is selected
[Code]....
View 2 Replies
View Related
Apr 10, 2009
I am having a form with a drop down and want to display the fields below it based on the drop down value selected. For example: my form has a drop down <select value> <values: A, B ,C, D) when I select A then I should get displayed a set of fields (like input fields, drop down fields etc) just below the main drop down and when I choose B then it should display a set of fields specific to B and like that. What technology / script to use this to achieve this. I have also attached the sample html page.
View 1 Replies
View Related
Jul 21, 2009
I would like to know if there is a way to get the selected input field inside an Iframe from the parent window, is there any way to do that?
View 3 Replies
View Related
Jan 9, 2009
I'm trying to replicate a feature found in hotmail, facebook, etc. When you type or select a recipient from an auto-suggest box for your message/email that recipient's name is put into the "To" field box and is encased (usually a blue rounded corner box) with a X to the far right. If the "X" is clicked the recipient is removed.
How can do you put the selected recipient into the encasing and insert it in the "To" field box? If there are multiple recipients how are they differentiated? For example, if there were a ";" between the recipients the semi-colon would separate the values.
View 8 Replies
View Related
Oct 31, 2011
New to working with javascript and I've come up with a function. I have a form with a dropdown and input field:
<form>
<select name="warranty" id="warranty" onChange="doadate()">
<option value="Select">Select</option>
<option value="In Warranty">In Warranty</option>
<option value="Out of Warranty">Out of Warranty</option>
<option value="DOA" selected>DOA</option>
</select>
<input name="doadate" type="text" id="doadate" value="<? echo $doadate; ?>"
size="20" readonly>
</form>
I need the input field to be disabled unless DOA is selected in the select form element. I've started on page load with document.form1.doadate.disabled=true. Then I've put an onChange handler in the select to call the function below:
<script type="text/javascript">
function doadate(){
val = document.form1.warranty.value;
if(val=='DOA'){
document.form1.doadate.disabled=false;
} else{
document.form1.doadate.disabled=true;
}}
</script>
But it's not working, it stays disabled after load even when the DOA is selected in the drop down form field.
View 4 Replies
View Related
Dec 30, 2011
I would like to disable a feature on my site if someone is in a textarea or input text field. Yet I can't seem to figure out how to check for this... Could someone give me an example of how I can determine if a user does not have a text input or textarea selected? Can't seem to get anything I found via google working.
View 2 Replies
View Related
Apr 9, 2010
Im using a jQuery script to show/hide a div based based on the selection made via a dropdown.
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
The problem im having is that the value used in the dropdown lists are price values eg 10.00
Consequently jQuery seems to interprit these as css notations, meaning the code doesnt work.
View 4 Replies
View Related
Aug 17, 2009
I have tryid to search for this, but apparently, I cant get the right words for it... What I want is to have an input field (Email) with the word "Email" predefined in it as value, but when a user clicks inside the field, the word disappear and he can write his own email...
View 4 Replies
View Related
Oct 21, 2011
I wanted to create a small DHTML code that created a unordered list of input forms dependent on the number selected from the select dropdown menu. Problem is that it doesn't seem to want to generate the list. I think the variables are within the scope of the function too, and I didn't get an errors from the javascript console when using firebug. The script itself runs, I tested it when I used the old standby alert(); to see if the script was active. Here's the code:
[Code]...
View 14 Replies
View Related
Jul 13, 2010
I have code for autosuggestion while typing in a text box written in Javascript and PHP. When I start typing a number I get a list of matching numbers and I'm able to select one of them with the mouse click. Now I have an other text box which should display a list of numbers based on the selection from the first textbox.
View 3 Replies
View Related
Jun 7, 2010
I am having a form with two input fields. I want to enter some text in the first input field and then the second field should get the same text. Is there a simple way (maybe a plugin) to do this with jQuery? It would be perfect if I even could output all these input fields values as normal text in <p> or <li> tags.
View 2 Replies
View Related
Feb 3, 2011
How I populate fields of a form with the data that relates to an item from a list box that user selects
Example:
List box contains item1, item2, item3
User selects item2 so want data connected to item2 displayed so it can be edited and updated.
View 10 Replies
View Related
Dec 30, 2011
This one should be easy. In fact, it was working for a long time as far as I know. Then I upgraded from jQuery 1.4.4 to 1.7.1 and a few things stopped working. (This is according to my client; it's possible it's been broken for a long time.)
So a customer logs in and sees his/her registration information. Name, address, phone number, etc... It gets this information from a MySQL database. For the customer's home address, there's a dropdown for the state (MA, NH, etc...) Rather than displaying the default specified in the HTML code, I have a bit of jQuery code that is supposed to change the dropdown selection to the user's home state as stored in the MySQL database.
Unfortunately, nothing happens. It rather than changing to the user's home state, it just displays the default state (AL, the first alphabetically).
[Code]..
I verified that $row['state'] contains valid data by outputting it as HTML on the page (my test data outputs "MA"). And I'm reasonably sure that this used to work in the past.
View 1 Replies
View Related
Mar 24, 2010
I want that data against each option should be loaded as the option is selected in the combo box. As, while registering on yahoo, when we select a country all provinces of that country are loaded. (No need to click a submit button.)
View 1 Replies
View Related
Nov 27, 2010
I have a bunch of DIVs (not an <option> List) each of the class "SongListItem". For one of the DIVs at a time, I set a "Selected" attribute, so it sort of acts like a ListBox. So two rows in the list might look like:
<div id="Item1" class="SongListItem">Item 1 Text</div>
<div id="Item2" Selected="True"class="SongListItem">Item2 Text</div>
Now I want to write a jQuery function which gets the ID of the SongListItem div that has Selected="True". So far, I have tried:
var SongID= $('.SongListItem[selected="True"]').attr("id");
and
var SongID= $('.SongListItem[selected="True"]').get(0).attr("id");
In both cases, I get a "Object does not support this method."
View 2 Replies
View Related
May 10, 2009
Is it possible to trigger a function that fires when an item is selected from the autocomplete box?
View 1 Replies
View Related
Nov 22, 2011
I am using jquery validate js for my validation. I need to validate and pass the value for the below senario.
I am having a dropdown box which has 2 option. Option 1 and Option 2.
And I have few checkboxes with same name. Depending upon the dropdown selection it should show/hide some checkboxes. Using javascript and CSS these are working fine.
The problem I am having is with the Select All function. If I check Select All it checks the hidden field also. The requirement is to select only the fields which are visible not the hidden one. Please suggest me how to do this.
Example
Here Value 3 and value 4 are common. If I select option Select Item 1 Value 1 will show and value 2 will be hide. If I select all it should not select value 2. As the name is common its selecting that also. It should not select value 2. This is the requirement
View 1 Replies
View Related
Jun 24, 2009
how can i set the attribute of an item in a select box to selected?
View 5 Replies
View Related
Mar 9, 2010
I got a page with 2 <select> the second one is populated by the 1st selected item. I want to know how can I reload just the second <select>.
View 2 Replies
View Related
Jun 5, 2009
I can access the drop-down value(s) the visitor has chosen by $("#ak option:selected").each(function () {... but now I want to force the drop-down list to be selected to a particular default value of my choosing ... how would I do this?I did try:
$("#ak option:selected").each(
function () {
$(this).text('-> Choose Accessory kind');
[code].....
View 1 Replies
View Related