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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -