I'm trying to load session values for textboxes,radio buttons,dropdown and checkboxes (for back button click scenario).
when I navigate from one page to next page I do store all checked/selected/entered values in session.
when i click on back button I want to load all those values from session in form
Problem:
specially having problem to load data on dropdown which is created dynamically while loading page( want to load selected value)
Any help would be appreciable!
I tried using selected index property but didn't work.
can I achieve it without changes the actual form?
can I have something by which I can load session values from function by setting few attributes or so! Thanks!
Update:
function LoadList()
{
var addselect="";
for(var i=11; i<=4999;i++)
{
if(addselect=="")
{
addselect="<option> "+i+"</option>";
}
else
{
addselect+= "<option> "+i+"</option>";
}
}
//console.log(addselect);
$('#9').html(addselect);
var textToFind =<?php echo $_SESSION['sys'];?>
var dd = document.getElementById('9');
for (var i = 0; i < dd.options.length; i++)
{
if (dd.options[i].text === textToFind)
{
dd.selectedIndex = i;
break;
}
}
}