function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
swethasfdcswethasfdc 

java.lang.IllegalArgumentException: Illegal view ID mybutton. The ID must begin with /

Hi all,

 I need a help.

 I am getting an exception  "java.lang.IllegalArgumentException: Illegal view ID mybutton. The ID must begin with / "

 

VF Page:

<apex:page controller="urlclass" tabStyle="Account">
<apex:form>
enter value of var1:<apex:inputText value="{!var1}"/>
enter value of var2:<apex:inputText value="{!var2}"/>
<apex:commandButton action="mybutton" value="my button"/>
</apex:form>
</apex:page>

 

 

Apex class:

 

public class urlclass {
public String var2 { get; set; }
public String var1 { get; set; }

public PageReference mybutton()
{
PageReference pr=new PageReference('/apex/pagerefurlexamp');
//PageReference pr=Apexpages.currentpage();
//pr.setRedirect(true);
return pr;
}
}

 Here i am trying to return to a page which i mentioned as partialURL.

 But i am getting that exception.

 

or else

 

How to return to a page using Page.existingPageName which is the other method.

I would like to know in both ways.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Chamil MadusankaChamil Madusanka

Use

 

<apex:commandButton action="{!mybutton}" value="my button"/>

 instead of

 

<apex:commandButton action="mybutton" value="my button"/>

 If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

All Answers

Chamil MadusankaChamil Madusanka

Use

 

<apex:commandButton action="{!mybutton}" value="my button"/>

 instead of

 

<apex:commandButton action="mybutton" value="my button"/>

 If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

This was selected as the best answer
swethasfdcswethasfdc

Awww...that was my mistake.....it was so simple.

I am able to work with partialURL,but when that comes to full URL it is giving the URL doesnot exist which is outside of salesforce.How to make it work??

I would also like to know using 2nd method -------->page.existingPageName

Starz26Starz26

For the second method:

 

Pagereference pr = page.PAGENAME

 

The only difference AFAIK is the fact that it will tie the page to the apex code metadat and thus not allow the page to be deleted while it is still referenced in the code.

sandeep@Salesforcesandeep@Salesforce

Thanks

Chamil you solved my problem