Sorry but I need you to please bell me out again
I have this:
- function getRequestDescriptions(requestCategory) {
$.ajax({
url: 'getRequestDescri.asp',
dataType: 'json',
data: { requestCategory: requestCategory }
})
.done(function(descriptionInfo) {
// get number of items in array given by asp
var Desc_count = descriptionInfo.length;
// start an array to hold re-arranged buildings array
var newDescriptionInfo = [];
// loop request descriptions
for (var i = 0; i < Desc_count; i += 1) {
// append an <option> tag to your <select>
$('#description').append('<option value="' + descriptionInfo[i].RequestDescriptionDisplay + '">' + descriptionInfo[i].RequestDescriptionDisplay + '</option>');
// set the key value to SiteContactDisplay so that it is easily referenced later
newDescriptionInfo['' + descriptionInfo[i].RequestDescriptionDisplay + ''] = descriptionInfo[i];
}
// Listen for the value of the <select> to change
$('#description').on('change', function () {
// Hidden inputs must already be available on the form before this Javascript is ever used
// Set the value of the hidden fields based on the <select>'s ID choosing the corret array element
$('input[name="RequestID"]').val(newDescriptionInfo[''+$(this).val()+''].RequestID);
});
});
Then this:
- <input name="RequestID" id="RequestID" type="text" width="300" value="" class="changeable" /><br>
<select name="description" id="description" style="width:600px;font-size:10pt;" class="changeable" data-summary="summSubCategory">
A user selects an option from Category dropdown (not shown) then values associated with that Category are populated into the description dropdown.
Our intention is that if a user selects a value from one of the available values from the description dropdown, then whatever the associated requestId will be populated in hidden form.
However, when I tried to test this, it displays a bunch of nulls along with real values.
More, it doesn't matter what value I select from the description dropdown, I get same values. (nulls and one value).
Can you please give me a hand on this?
Thanks in advance