Link to home
Start Free TrialLog in
Avatar of Gary_Nelson
Gary_Nelson

asked on

HTML Listbox on ipad safari doesn't work right

I have an asp.net web app that on different pages presents html listboxes. On all other browsers they work fine, except on ipad safari. On ipad safari the listbox appears blank, with the first option right in the middle. It won't scroll up or down, and it only presents the first item. When I click it, the list of all the options flashes on and off the screen, and it always choses the first item. There appears to be no way to chose any other item of the list.

By the way, safari on pc works fine, it only happens ont he ipad.Any ideas?
Avatar of EMB01
EMB01
Flag of United States of America image

Let me see your code, please.  Does it look something like this:

<html>
<body>
<select onChange="alert('test');">
<option>Select an option</option>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</body>
</html>
Avatar of Gary_Nelson
Gary_Nelson

ASKER

This is the code that creates the listbox. The program makes an ajax call and returns a string separated by tabs, commas or semicolons. It turns the string into an array and creates a listbox out of it. I think the problem is that the ipad only uses dropdown combo boxes, but not an open listbox.


		if (this.listData.length >0){
			var list = document.createElement('select');
			list.style.cssText="WIDTH: 350px; HEIGHT: 176px;";
			list.size = "11";
			list.onclick = function () {aceptarClick(option)};
                                                                AddEvent(list, "KeyHit(event, '" + option + "')");
			list.setAttribute('id', 'askText');
			var i=0;
			var schar=String.fromCharCode(9);
			if(this.listData.indexOf(schar)==-1) schar=";";
			if(this.listData.indexOf(schar)==-1) schar=",";
			var optList=this.listData.split(schar);
			while(optList[i]!=null&&optList[i].length>0){
				var opt = document.createElement('option');
				opt.innerHTML = optList[i];
				opt.value=optList[i];
				list.appendChild(opt);
				i++;				
			}
			if (list.length > -1){list.selectedIndex=0};
			y.appendChild(list);
			var br = document.createElement("br");
			y.appendChild(br);
		}

Open in new window

Thanks, but do you have sample output?
ASKER CERTIFIED SOLUTION
Avatar of Gary_Nelson
Gary_Nelson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I put my answer as the solution because in the end I solved the problem myself. I put a grade C because the solution is not exactlly what I wanted, but it works.