You need to sign in to do that
Don't have an account?
santhosh konathala 17
Hi can anybody help on this.Below is my vf page controller not deleting records.Please help where I did wrong?
vf page:
<apex:page controller="AccountDelete" >
<apex:form >
<apex:outputlabel value="RecordToDelete "/>
<apex:inputText value="{!RecordToDelete}" label="RecordToDelete"/> <br/><br/>
<apex:outputlabel value="phone"/>
<apex:inputText label="phone"/><br/><br/>
<apex:commandButton value="Delete" action="{!DeleteName}"/>
<apex:param name="AccountDelete" value="abc" assignTo="{!RecordToDelete}"/>
</apex:form>
</apex:page>
Controller:
Public with sharing class AccountDelete{
Public Id RecordToDelete{get;set;}
Public List<account> acclist {get;set;}
public void DeleteName()
{
acclist=Database.query('Select id from account where id=:'+ RecordToDelete);
system.debug('Record id to delete ='+ RecordToDelete);
if(acclist.size()>0 & acclist !=null)
{
delete acclist;
}
}
}
<apex:page controller="AccountDelete" >
<apex:form >
<apex:outputlabel value="RecordToDelete "/>
<apex:inputText value="{!RecordToDelete}" label="RecordToDelete"/> <br/><br/>
<apex:outputlabel value="phone"/>
<apex:inputText label="phone"/><br/><br/>
<apex:commandButton value="Delete" action="{!DeleteName}"/>
<apex:param name="AccountDelete" value="abc" assignTo="{!RecordToDelete}"/>
</apex:form>
</apex:page>
Controller:
Public with sharing class AccountDelete{
Public Id RecordToDelete{get;set;}
Public List<account> acclist {get;set;}
public void DeleteName()
{
acclist=Database.query('Select id from account where id=:'+ RecordToDelete);
system.debug('Record id to delete ='+ RecordToDelete);
if(acclist.size()>0 & acclist !=null)
{
delete acclist;
}
}
}
try this:
Thanks
Ankur Saini
try below code thanks
let me inform if it helps you and mark it best answer if it helps you
Thanks for your reply..
The code which you sent not deleting any record when I pass record name through vf page.
Regards,
santhosh