-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
2Questions
-
3Replies
Skipping validation after clicking REMOVE button
I have a wrapper class with checkboxes, and a pageblock table with input fields. Some fields are mandatory to fill in to save them, but I also have a Remove button and I'd like to skip validation of the fields, as I don't want to populate the form just to delete them. Do you have any ideas how to do that? Immediate=true doesn't work, because it doesn't send the value of the checkbox to the controller.
-
- Tomasz Woźniak
- January 15, 2017
- Like
- 0
- Continue reading or reply
Adding controller extension intereferes with saving method.
Hello. I'm new to salesforce. I created simple apex page, using standard controller and custom extension. I have contact list for a specific account shown as input fields to edit that straight away. The problem is when I added the extension, standard save function won't work, and I couldn't really find the solution. (without an extension saving works fine, but then I can see EVERY contact, not only contact connected to specific account). I would really appreciate some help. This is the code:
and here is my extension:
I tried adding this code:
<apex:page standardController="Contact" recordSetVar="contacts" extensions="myExt"><apex:form > <apex:pageBlock title="Contacts"> <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton action="{! save}" value="Save"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!contacts}" var="contact"> <apex:column ><apex:facet name="header">First name</apex:facet><apex:inputField value="{!contact.FirstName}" required="true"/></apex:column> <apex:column ><apex:facet name="header">Last name</apex:facet><apex:inputField value="{!contact.LastName}" required="true"/></apex:column> <apex:column ><apex:facet name="header">E-mail</apex:facet><apex:inputField value="{!contact.Email}"/></apex:column> <apex:column ><apex:facet name="header">Phone</apex:facet><apex:inputField value="{!contact.Phone}"/></apex:column> <apex:column ><apex:facet name="header">Description</apex:facet><apex:inputField value="{!contact.Description}"/></apex:column> </apex:pageBlockTable> </apex:pageBlock></apex:form> </apex:page>
and here is my extension:
public class myExt { public ApexPages.StandardSetController stdCntrlr {get; set;} public myExt(ApexPages.StandardSetController controller) { stdCntrlr = controller; contactAddList = new List<Contact>(); } private String sortOrder='LastName'; private String acId=ApexPages.currentPage().getParameters().get('Id'); public List<Contact> getContacts(){ List<Contact> results = Database.query( 'SELECT Id, FirstName, LastName, Phone, Email, Description ' + 'FROM Contact WHERE AccountId=\'' + acId + '\' ' + 'ORDER BY ' + sortOrder + ' ASC ' + 'LIMIT 10' ); return results; } }
I tried adding this code:
public PageReference save() { stdCntrlr.save(); return Apexpages.currentPage(); }to invoke standard save method, but it only refreshes the page.
-
- Tomasz Woźniak
- January 10, 2017
- Like
- 0
- Continue reading or reply
Adding controller extension intereferes with saving method.
Hello. I'm new to salesforce. I created simple apex page, using standard controller and custom extension. I have contact list for a specific account shown as input fields to edit that straight away. The problem is when I added the extension, standard save function won't work, and I couldn't really find the solution. (without an extension saving works fine, but then I can see EVERY contact, not only contact connected to specific account). I would really appreciate some help. This is the code:
and here is my extension:
I tried adding this code:
<apex:page standardController="Contact" recordSetVar="contacts" extensions="myExt"><apex:form > <apex:pageBlock title="Contacts"> <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton action="{! save}" value="Save"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!contacts}" var="contact"> <apex:column ><apex:facet name="header">First name</apex:facet><apex:inputField value="{!contact.FirstName}" required="true"/></apex:column> <apex:column ><apex:facet name="header">Last name</apex:facet><apex:inputField value="{!contact.LastName}" required="true"/></apex:column> <apex:column ><apex:facet name="header">E-mail</apex:facet><apex:inputField value="{!contact.Email}"/></apex:column> <apex:column ><apex:facet name="header">Phone</apex:facet><apex:inputField value="{!contact.Phone}"/></apex:column> <apex:column ><apex:facet name="header">Description</apex:facet><apex:inputField value="{!contact.Description}"/></apex:column> </apex:pageBlockTable> </apex:pageBlock></apex:form> </apex:page>
and here is my extension:
public class myExt { public ApexPages.StandardSetController stdCntrlr {get; set;} public myExt(ApexPages.StandardSetController controller) { stdCntrlr = controller; contactAddList = new List<Contact>(); } private String sortOrder='LastName'; private String acId=ApexPages.currentPage().getParameters().get('Id'); public List<Contact> getContacts(){ List<Contact> results = Database.query( 'SELECT Id, FirstName, LastName, Phone, Email, Description ' + 'FROM Contact WHERE AccountId=\'' + acId + '\' ' + 'ORDER BY ' + sortOrder + ' ASC ' + 'LIMIT 10' ); return results; } }
I tried adding this code:
public PageReference save() { stdCntrlr.save(); return Apexpages.currentPage(); }to invoke standard save method, but it only refreshes the page.
- Tomasz Woźniak
- January 10, 2017
- Like
- 0
- Continue reading or reply