• Weesilmania
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Hello

 

 I have created a form that contains an action region which is being rerendered when a button inside that region is clicked. The action region basically consists of a input text box, a list of values, and 2 buttons to add or remove values from the list of values.

 

If I label the buttons with words such as 'Add' and 'Remove', the action region rerenders correctly when the buttons are clicked. If I label the 'Add' button with any number of '>' (as I did initially) the entire form submits instead of just the action region.

 

This strange behaviour is definitely caused by changing the button label alone. It is also very difficult to troubleshoot as I assumed the fault lay with my code and no debug methodolgies (including the debug logs) point to the cause of the error.

 

For the sake of completeness I'll post the entire code, although the affect area is quite small.

 

VisualForce (search for '>>' to find the troublesome label)

 

 

<apex:page showHeader="false" controller="LoginController" extensions="FrontOfficeConfigExt" title="{!$Label.site.register}" standardStylesheets="true">
<c:StyleSheet />
<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript" src="{!URLFOR($Resource.AutoSuggest,'actb.js')}"></script>
<script language="javascript" type="text/javascript" src="{!URLFOR($Resource.AutoSuggest,'common.js')}"></script>
<script>
function initAutoSuggest() {
var channels = {!SkillsToJs} //new Array();
//alert(channels);
actb(txtSkil,channels);
}
<!-- assign the setupPage function to the body onload event -->
var previousOnload = window.onload;
window.onload = function() {
if (previousOnload) {
previousOnload();
}

initAutoSuggest();
}
</script>
<div id="wrapper">
<div id="main" style="height:400px">
<c:SiteHeader ></c:SiteHeader>
<apex:form >
<apex:actionFunction name="selectSkill" rerender="skillBlock" status="workingstatus"/>
<apex:actionFunction name="deleteSkill" rerender="skillBlock" status="workingstatus"/>
</apex:form>

<apex:form >
<apex:messages />
<apex:pageBlock mode="edit" title="{!$Label.reg_pb_newUserTitle}">
<apex:pageBlockSection title="{!$Label.reg_pbs_contact}" columns="1">
<apex:inputField value="{!candidate.FirstName__c}"/>
<apex:inputField value="{!candidate.LastName__c}"/>
<apex:inputField value="{!candidate.Email__c}"/>
<apex:inputField value="{!candidate.StreetAddress__c}"/>
<apex:inputField value="{!candidate.Postcode__c}"/>
<apex:inputField value="{!candidate.City__c}"/>
<apex:inputField value="{!candidate.State__c}"/>

<apex:pageBlockSectionItem labelStyleClass="labelStyle" dataStyleClass="dataStyle">
<apex:outputLabel value="{!$Label.reg_text_countryLabel}" for="country" ></apex:outputLabel>
<apex:selectList id="country" value="{!candidate.Country__c}" size="1">
<apex:selectOptions value="{!comboCountriesValues}"></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:inputField value="{!candidate.Login__c}"/>
<apex:pageblocksectionItem >
<apex:outputLabel value="{!$ObjectType.Candidate__c.fields.Password__c.label}" for="pwd"></apex:outputLabel>
<apex:outputPanel layout="block" styleClass="requiredInput">
<apex:outputPanel layout="block" styleClass="requiredBlock"/>
<apex:inputSecret id="pwd" value="{!candidate.Password__c}" required="true"/>
</apex:outputPanel>
</apex:pageblocksectionItem>
<apex:pageblocksectionItem >
<apex:outputLabel value="{!$ObjectType.Candidate__c.fields.passwordConfirmation__c.label}" for="pwdConfirmation"></apex:outputLabel>
<apex:outputPanel layout="block" styleClass="requiredInput">
<apex:inputSecret id="pwdConfirmation" value="{!candidate.passwordConfirmation__c}" required="true"/>
<apex:outputPanel layout="block" styleClass="requiredBlock"/>
</apex:outputPanel>
</apex:pageblocksectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="{!$Label.reg_pbs_education}" columns="1" >
<apex:pageBlockSectionItem rendered="{!layout.ExperienceDisplay__c}">
<apex:outputLabel value="{!$Label.reg_text_experienceLabel}" for="experience" ></apex:outputLabel>
<apex:selectList id="experience" value="{!experienceID}" size="1">
<apex:selectOptions value="{!comboExperienceValues}"></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!layout.ExperienceDisplay__c}">
<apex:outputLabel value="{!$Label.reg_text_educationLabel}" for="education" ></apex:outputLabel>
<apex:selectList id="education" value="{!educationID}" size="1">
<apex:selectOptions value="{!comboEducationValues}"></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:inputField value="{!candidate.SalaryExpectationAmount__c}" rendered="{!layout.SalaryExpectation__c}"/>
<apex:inputField value="{!candidate.SalaryExpectationCurrency__c}" rendered="{!layout.SalaryExpectation__c}"/>
<apex:inputField value="{!candidate.Motivation__c}" rendered="{!layout.Motivation__c}"/>
</apex:pageBlockSection>

<apex:actionRegion >
<apex:pageBlockSection id="skillBlock" columns="3" title="Skills">
<apex:pageblocksectionitem dataStyle="margin-left:200px;float:left">
<apex:inputText id="txtSkills" value="{!skillSelection}"/><br/>
<script> var txtSkil= document.getElementById("{!$Component.txtSkills}");</script>
</apex:pageblocksectionitem>

<apex:outputpanel style="text-align:center">
<apex:commandButton value=">>" action="{!doSelectSkill}" rerender="skillBlock" style="padding:0px;margin:25px 0px 0px 0px" status="workingstatus">
</apex:commandButton>

<apex:commandButton value="<<" action="{!doDeleteSkill}" rerender="skillBlock" style="padding:0px;margin:3px 0px 0px 0px" status="workingstatus">
</apex:commandButton>
</apex:outputpanel>

<apex:pageblockSectionitem dataStyle="float:left;margin-right:240px">
<apex:selectList value="{!candidateSkillsSelection}" size="5" multiselect="true" required="false" id="chNameList" rendered="true">
<apex:selectOptions value="{!candidateSkillsOptions}" />
</apex:selectList>
</apex:pageblocksectionitem>
<apex:actionstatus startText="{!$Label.any_As_Working}..." id="workingstatus" startStyleClass="status" />
</apex:pageBlockSection>
</apex:actionRegion>

<apex:pageBlockSection title="{!$Label.reg_pbs_cv}" columns="1" rendered="{!layout.CVDisplay__c}">
<apex:pageBlockSectionItem >
<apex:outputLabel value="CV" for="myCV"/>
<apex:inputFile value="{!attachment.body}" filename="{!attachment.name}" id="myCV"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<!-- ##################### EEO Information Countrywise ###################### -->
<apex:pageBlockSection title="{!$Label.reg_pbs_USEEO}" columns="1" rendered="{!USEEO}">
<apex:outputText escape="false" value="{!layout.EEO_Text__c}"/>
<apex:inputField value="{!candidate.GenderList__c}"/>
<apex:inputField value="{!candidate.Veteran_Status__c}"/>
<apex:inputField value="{!candidate.EthnicityList__c}"/>
<apex:inputField value="{!candidate.Handicapped__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="{!$Label.reg_pbs_UKEEO}" columns="1" rendered="{!UKEEO}">
<apex:outputText escape="false" value="{!layout.EEO_Text__c}"/>
<apex:inputField value="{!candidate.GenderList__c}"/>
<apex:inputField value="{!candidate.UK_Age_Group__c}"/>
<apex:inputField value="{!candidate.UK_Sexual_Orientation__c}"/>
<apex:inputField value="{!candidate.Disability__c}"/>
<apex:inputField value="{!candidate.UK_Ethnic_Origin__c}"/>
<apex:inputField value="{!candidate.English_First_Language__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="{!$Label.reg_pbs_IrelandEEO}" columns="1" rendered="{!IrelandEEO}">
<apex:outputText escape="false" value="{!layout.EEO_Text__c}"/>
<apex:inputField value="{!candidate.GenderList__c}"/>
<apex:inputField value="{!candidate.IE_Marital_Status__c}"/>
<apex:inputField value="{!candidate.IE_Family_Status__c}"/>
<apex:inputField value="{!candidate.IE_Sexual_Orientation__c}"/>
<apex:inputField value="{!candidate.IE_Religion__c}"/>
<apex:inputField value="{!candidate.IE_Age__c}"/>
<apex:inputField value="{!candidate.IE_Disability__c}"/>
<apex:inputField value="{!candidate.IE_Race__c}"/>
<apex:inputField value="{!candidate.IE_Traveller_Community__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="{!$Label.reg_pbs_terms}" columns="1" rendered="{!layout.Terms_and_Conditions__c}">
<apex:outputText escape="false" value="{!layout.Terms_and_Conditions_Text__c}"/>
<apex:pageBlockSectionItem >
<apex:inputCheckbox value="{!tnc}" id="tnc"/>
<apex:outputtext value="{!$Label.reg_text_accept}" ></apex:outputText>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockButtons style="margin-left:200px;float:left" location="bottom">
<apex:commandButton action="{!backToJobDetail}" immediate="true" value="{!$Label.btn_Cancel}"></apex:commandButton>
<apex:commandButton action="{!doRegister}" value="{!$Label.btn_Submit}" id="submit"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</div>
</div>

</apex:page>

 

  Apex (the code is 500 lines for this controller so I'm only pasting the add method. Although the apex code is irrelevant anyway)


 

//select the Skill from the first picklist and add to the second picklist
public PageReference doSelectSkill() {
Boolean isExist = false;
// We cant upload an empty Skill
if(skillSelection != ''){
System.debug('candidate.City__c: '+candidate.City__c);
System.debug('skillSelection: '+skillSelection);
// We check if Skill doesn't already exist
for(SelectOption candiSkill: candidateSkillsOptions){
if(candiSkill.getValue() == skillSelection){
isExist = true;
}
}
if(!isExist)
candidateSkillsOptions.add(new SelectOption(skillSelection, skillSelection));
}
return null;
}

 

If I hazard a guess I'd say the '>' character is being interpreted at a closure of a tag?

 

Thought I'd let you guys know as James Penfold suggested I post to the discussion board.

 

Wes