You need to sign in to do that
Don't have an account?
Sanjay92062
apex:commandButton action="{!Save}" is not saving my pageBlockSection code.
Hi,i am new to VS pages.
I am trying to maintain different pageBlockSections, whenever,i saved the record,it is not saved one of the pageBlocksection code.
Please help me here.
I am able to save the name and description, but not multi select values.
Below is the code :
Controller Code is below :
Please help me.
Thank you in advace.
I am trying to maintain different pageBlockSections, whenever,i saved the record,it is not saved one of the pageBlocksection code.
Please help me here.
I am able to save the name and description, but not multi select values.
Below is the code :
<apex:page standardController="test__c" extensions="multitest" lightningStylesheets="true"> <style type="text/css"> .customPopupStyle{ background-color: white; border-style: solid; border-width: 2px; left:20%; padding:10px; position: absolute; z-index: 9999; width: 500px; top:20%;} .disabledTextBoxStyle{ background-color: white; border: 1px solid; color: black; cursor: default; width: 90px; display: table; padding: 2px 1px; text-align: right;}.closeButtonStyle{ float: right;} </style> <apex:form > <apex:pagemessages ></apex:pagemessages> <apex:pageBlock title="Create a test Job" id="pgBlkId"> <apex:pageBlockButtons > <apex:commandButton action="{!Save}" value="Save"/> <apex:commandButton action="{!Cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:pageBlockSection title="MultiSelection" collapsible="true" id="pgBlkSecId"> <apex:inputtextarea value="{!lookUp}" label="Contact"/> <apex:commandButton value="Add Value" reRender="out" action="{!add}"/> <apex:outputPanel id="out"> <apex:outputPanel styleClass="customPopupStyle" rendered="{!bool}"> <apex:commandButton value="X" title="Close the popup" action="{!closePopup}" styleClass="closeButtonStyle" rerender="out"/> <apex:pageBlockTable value="{!show}" var="e" title="show"> <apex:column > <apex:inputCheckbox value="{!e.check}"/> <apex:actionSupport event="onclick" action="{!inIt}"/> </apex:column> <apex:column > <apex:commandLink value="{!e.con.Name}"/> </apex:column> </apex:pageBlockTable> </apex:outputPanel> </apex:outputPanel> <apex:commandButton value="Save" action="{!mySave}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Details" collapsible="true" id="pgBlkSecIdd"> <apex:inputField value="{!tes.Name}"/> <apex:inputField value="{!tes.Description__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Controller Code is below :
public with sharing class multi_test { public string lookUp{get;set;} public list<conContact> contactList{get;set;} public boolean allbool{get;set;} public string inputValue{get;set;} public boolean bool{get;set;} public set<id> contactids{get;set;} public test_c tes {get;set;} ApexPages.StandardController controller; public multijtbdaction_test(ApexPages.StandardController con) { controller = con; contactList = new list<conContact>(); bool = false; contactids = new Set<Id>(); this.tes = (test__c)con.getRecord(); } public class conContact { public car__c con{get;set;} public boolean check{get;set;} public conContact(car__c c, boolean boo){ con = c; check = boo; } } public void inIt() { list<car__c> selectedContact = new list<car__c>(); lookUp = ''; for(conContact conObj : contactList) { if(conObj.check != false){ system.debug('conObj.con'+conObj.con); selectedContact.add(conObj.con); lookUp += conObj.con.name + ' '; system.debug('lookUp::'+lookUp); contactids.add(conObj.con.id); } } bool = true; } public list<conContact> getShow(){ for(car__c coObj:[select id,name from car__c]){ contactList.add(new conContact(coObj,allbool)); } return contactList; } public PageReference mySave() { list<car__c> updateSelectedContact = new list<car__c>(); id accId = ApexPages.CurrentPage().getparameters().get('id'); for(car__c co:[select id,name,test__c from car__c where id =: contactids]) { co.test__c = accId; updateSelectedContact.add(co); } update updateSelectedContact; return null; } public void closePopup() { bool = false; } public void add(){ bool = true; } }
Please help me.
Thank you in advace.
Are you seeing any errors? Is there a simplified code snippet that I can use to replicate this behavior . Thanks