+ Start a Discussion
TehNrdTehNrd 

Data being wiped out of inputFields with required selectList, IE9

If you have a required selectList on a visualforce page with IE9 you are not going to have a good time. It would appear that with this combination all sorts of data binding issues are occuring and values entered into other fields are being wiped out. The good news is this is very easy to reproduce. All you need is the page below:

 

<apex:page standardController="Account" showHeader="false">
    <apex:form >
        <apex:outputPanel id="formSection">
            
		Enter something: <apex:inputField value="{!Account.Name}" required="true"/><br/>
		
		Don't select anything:  <br/> 
		<apex:selectList value="{!Account.BillingState}" id="state" required="true" size="1">
			<apex:selectOption itemvalue="" itemLabel="--None--"/>
			<apex:selectOption itemvalue="N/A" itemLabel="N/A"/>       		
		</apex:selectList>
		<apex:message styleClass="customError" for="state"/><br/><br/>

		Click this twice, the second time the value entered in the Account.Name will be wiped out.<br/>
           	<apex:commandButton value="Submit" action="{!save}" status="disableSave" rerender="formSection"/> 
            
        </apex:outputPanel>
    </apex:form>
</apex:page>

Open up IE9. I know this may be hard for you but you can do it. Enter a value in the name field, leave the pick list blank. Click Submit button. A nice little message will show up telling you the picklist field is blank. It may be tempting to fill this in but do not! Ignore it! Press the Submit button again. You will notice the value entered in the name field is wiped out, not good.

 

Any ideas as to a fix? If you figure this one out you have two ice cold beers from me waiting for you at Dreamforce but I have a  feeling this is a bug only salesforce.com can fix.

 

Oh, and forcing the page to run in some IE8/7 compatibilty mode isn't an option, sorry. The reason being is the actual page is iframed into a large corporate website and it is not possible to force the parent frame to run in compatibilty mode. Something that is required as compatibilty mode is inherited from the parent page with IE9.

 

-Jason

Anup JadhavAnup Jadhav

Hey Jason,

 

Have you tried setting cache="true" in the <apex:page> tag?

 

Regards,

Anup

TehNrdTehNrd

Hi Anup,

 

cache="true" had no effect.

 

-Jason

TehNrdTehNrd

New #salesforce issues site coming through in the clutch!  ActionSupport ajax events does not fire setters for page input variables for IE

 

Just need to wrap everything in a body tag like so:

 

<apex:page standardController="Account" showHeader="false">
    <body>
		<apex:form >
			<apex:outputPanel id="formSection">
				
			Enter something: <apex:inputField value="{!Account.Name}" required="true"/><br/>
			
			Don't select anything:  <br/> 
			<apex:selectList value="{!Account.BillingState}" id="state" required="true" size="1">
				<apex:selectOption itemvalue="" itemLabel="--None--"/>
				<apex:selectOption itemvalue="N/A" itemLabel="N/A"/>       		
			</apex:selectList>
			<apex:message styleClass="customError" for="state"/><br/><br/>

			Click this twice, the second time the value entered in the Account.Name will be wiped out.<br/>
				<apex:commandButton value="Submit" action="{!save}" status="disableSave" rerender="formSection"/> 
				
			</apex:outputPanel>
		</apex:form>
	</body>
</apex:page>

 I guess I owe myself two cold beers at Dreamforce ;-)

 

-Jason

 

Anup JadhavAnup Jadhav

That's awesome, but it doesn't explain why it failed in the first place. One of IE's quirks I suppose.

 

- Anup

Andy BoettcherAndy Boettcher

That's kind of like Beer Inception?

 

(good job figuring it out!)

 

-Andy