javascript - New page not opening with the help of pagereference -
i have html input button calls javascript function in vf page. after execution of javascript function want open detail page of account in new apex window. writing below .
<input type="button" value="save" onclick="saveimage()"/> <apex:actionfunction name="savefn" action="{!savedata}" rerender=""> <apex:param name="x" value="" assignto="{!saveimagevalue}" /> </apex:actionfunction>
public void savedata() { string accid,accname; for(account a:[select id,name account id=:account]) { accid=a.id; accname=a.name; } //doing stuff----- opendetailpage(account); } public pagereference opendetailpage(string acc) { /**acc contains id of account in string format**/ pagereference ref = new pagereference('/'+acc); ref.setredirect(true); return ref; }
i able debug out opendetailpage logs unable open page. 1 point me doing wrong ?
first thing, function reference "savedata" in visualforce page named "savedatadata" in apex code.
second thing, "savedata" of type void. needs return page reference.
public pagereference savedata() { ... //skipping unchanged stuff //doing stuff----- return opendetailpage(account); }
Comments
Post a Comment