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
pupilstuffpupilstuff 

java.lang.IllegalArgumentException: Illegal view ID doSearch(). The ID must begin with /

Hello ,

 

I am frequently getting this error please look at this .I am passing BId=013 to apex class.

 

VF Page

 

<apex:page showHeader="false" standardController="travel_status__c" extensions="travel_Emp_info">
<html><br></br><br></br>
<head> <b><big><center> <font face="Times New Roman" size="+3" color="#ff0000">Capgemini Travel Desk</font></center></big></b></head>
<br></br><br></br>
<apex:form id="f1">


 <apex:pageBlock id="block" >
   <apex:pageBlockSection title="Login" id="pageblock" >
     <apex:outputtext id="corp" value="Corp ID"/>
     <apex:outputtext value="Name"/>
     <apex:outputtext value="Project Name"/>
     <apex:outputtext value="Manager"/>
   <apex:pageBlockSection >
   <apex:inputText id="BId1" value="{!BId}"/>
  
      <apex:commandButton value="Submit" action="doSearch()"/>
     </apex:pageBlockSection>

    
     <apex:pageBlockTable value="{!result}" var="l" rendered="{!NOT(ISNULL(result))}">
        
              <apex:column value="{!l.Booking_ID__c}"/>
                <apex:column value="{!l.Emp_ID__c}"/>
                <apex:column value="{!l.Name__c}"/>
                 <apex:column value="{!l.Status__c}"/>
                <apex:column value="{!l.Remark__c}"/>
         
            
           </apex:pageBlockTable>
    
    

    <apex:commandButton value="Create New Requet" />
   </apex:pageBlockSection>  
 </apex:pageBlock> 
</apex:form>
</html>
</apex:page>

 

 

Apex class

 

public class travel_Emp_info
  {
     List<travel_status__c> result;
     public integer BId;
     public final travel_status__c o;
     public  travel_Emp_info(ApexPages.StandardController ctlr)
     {
     this.o=(travel_status__c)ctlr.getRecord();
 
     }

      public List<travel_status__c> getResult() {
      return result;
       }
    public void setBId(integer s)
    {
    BId=s;

    System.debug('the value is '+BId);
    }
    public integer getBId()
    {
     return BId;
    }

    public PageReference doSearch(){
    System.debug('the value inside'+BId);
    result=[Select Booking_ID__c,Remark__c,Status__c,Name__c,Emp_ID__c from travel_status__c where Booking_ID__c=:BId];
    return null;
   }
}

 

I have done that lot of times before ..but don't know why I am getting this error.

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

Change your code

 

  <apex:commandButton value="Submit" action="{!doSearch}"/>

 

instead of

 

  <apex:commandButton value="Submit" action="doSearch()"/>

 

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

 

public String BId;

 

instead of

 

public integer BId;

 

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.

pupilstuffpupilstuff

thanks for reply,

 

But I was using String only ..just for testing purpose I used Integer .i am getting same error with String also

Chamil MadusankaChamil Madusanka

Then, can you post the whole error message with line no

pupilstuffpupilstuff

This is the only error message I am getting without any line no.

 

java.lang.IllegalArgumentException: Illegal view ID doSearch(). The ID must begin with / 

 

 

 

I have checked debug logs .Control is not going into the dosearch() function in Apex class

Chamil MadusankaChamil Madusanka

Change your code

 

  <apex:commandButton value="Submit" action="{!doSearch}"/>

 

instead of

 

  <apex:commandButton value="Submit" action="doSearch()"/>

 

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
pupilstuffpupilstuff

may many thanks for helpming me out .This worked

I have done this  lot of time but did the mistake .Sorry for wasting your time for that small thing