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
pradyprady 

java.lang.IllegalArgumentException: Illegal view ID this is next. The ID must begin with /

Hi,

 

I have a very simple Vf pge which accepts an inputtextfield and i want this to be passed on to the controller and the text inputed in appended with hello and shown in the textbox.

 

Here is my code

 

 

public with sharing class tpagecontroller {
public string  b1 {get;set;}

    public string getval() {
b1=b1+'hello' ;

        return b1;
    }



public tpagecontroller()
{

}


}

 

 

VF page

 

 

<apex:page controller="tpagecontroller">
<apex:form >
<apex:pageBlock id="qer">
<apex:inputText value="{!b1}"/>
<apex:commandButton action="{!getval}"   value="click" reRender="qer" />
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
  </apex:pageBlock>
  </apex:form>
</apex:page>

 

 

I am getting this error which i click the button

 

 

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

 

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

No, you can do this outside of it as well.

 

I wouldn't do it in javascript unless performance is really important , as its a more complex way of doing things.

 

If you want to concatenate into a third box I'd suggest an action method in your controller that is invoked when the button is clicked and does exactly that.

 

Something like:

 

Controller:

 

 

public with sharing class tpagecontroller {
public string  b1 {get;set;}
public string  b2 {get;set;}
public string  b3 {get;set;}

    public tpagecontroller()
    {
    }

    public PageReference populateThird()
    {
        b3=b1+b2;
        return null;
    }
}

 

 

Page:

 

 

<apex:page controller="tpagecontroller">
<apex:form >
<apex:pageBlock id="qer">
<apex:inputText value="{!b1}"/>
<apex:inputText value="{!b2}"/>
<apex:commandButton action="{!populateThird}" value="click" reRender="qer" />
<apex:inputText value="{!b3}"/>

  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
  </apex:pageBlock>
  </apex:form>
</apex:page>

 

 

 

All Answers

bob_buzzardbob_buzzard

As your command button action method is returning a string literal made up of the input text plus 'hello', this is taken as the ID of an sobject you'd like to navigate to.

 

I'd suggest you want to change your page to something like the following - this will reload the page with the updated details (I think - not tested it but should be close):

 

 

<apex:page controller="tpagecontroller">
<apex:form >
<apex:pageBlock id="qer">
<apex:inputText value="{!b1}"/>
<apex:outputText value="Concatenated value = {!val}"/>
<apex:commandButton value="click" reRender="qer" />
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
  </apex:pageBlock>
  </apex:form>
</apex:page>

 

 

pradyprady

Thanks Bob...

This probably solves the problem i got... But i am wondering is there any way we can have the value of the textbox changed? Like for instance i would like to have the text box prepopulated with some value from database and allow users to edit it..

bob_buzzardbob_buzzard

That should be pretty straightforward - you just need to pre-populate the value of b1 when you construct your controller.

 

Controller:

 

 

public with sharing class tpagecontroller {
public string  b1 {get;set;}

    public tpagecontroller()
    {
        // b1 can be populated from the database here if required
        b1='Edit me';
    }
}

 

 

 

Page:

 

 

<apex:page controller="tpagecontroller">
<apex:form >
<apex:pageBlock id="qer">
<apex:inputText value="{!b1}"/>
<apex:commandButton value="click" reRender="qer" />
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
  </apex:pageBlock>
  </apex:form>
</apex:page>

 

 

 

pradyprady

So i can put the values in the textbox from the constructor but cant do the same outside of it?

For example i have 2 textboxes first name and lastname and i want first name and latname concatinated in a third textbox.. I know i can do it in javascript.

 

I am trying to learn as i go, hence i come up with these questions

 

Thanks once again for your clarifications

bob_buzzardbob_buzzard

No, you can do this outside of it as well.

 

I wouldn't do it in javascript unless performance is really important , as its a more complex way of doing things.

 

If you want to concatenate into a third box I'd suggest an action method in your controller that is invoked when the button is clicked and does exactly that.

 

Something like:

 

Controller:

 

 

public with sharing class tpagecontroller {
public string  b1 {get;set;}
public string  b2 {get;set;}
public string  b3 {get;set;}

    public tpagecontroller()
    {
    }

    public PageReference populateThird()
    {
        b3=b1+b2;
        return null;
    }
}

 

 

Page:

 

 

<apex:page controller="tpagecontroller">
<apex:form >
<apex:pageBlock id="qer">
<apex:inputText value="{!b1}"/>
<apex:inputText value="{!b2}"/>
<apex:commandButton action="{!populateThird}" value="click" reRender="qer" />
<apex:inputText value="{!b3}"/>

  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
  </apex:pageBlock>
  </apex:form>
</apex:page>

 

 

 

This was selected as the best answer
pradyprady

Thanks.. this clears out all my queries..

You rock :smileyvery-happy:

venkat4cloudvenkat4cloud

SIR,

 i got the same error........plz suggest me

 

VISUALFORCE PAGE

 

<apex:page controller="GetAccountsController" >
<apex:form >
<apex:pageBlock >

<apex:dataTable value="{!MyAccounts}" var="acc">
<apex:column headerValue="Name">
<apex:commandLink action="invokeService" value="{!acc.Name}" reRender="resultpanel">
<apex:param name="id" value="{!acc.id}"/>
</apex:commandLink>
</apex:column>
<apex:column headerValue="Industry">
{!acc.Industry}
</apex:column>

<apex:column headerValue="Phone">
{!acc.Phone}
</apex:column>

 </apex:dataTable>

</apex:pageBlock>
<apex:pageBlock title="Fetch the Data">
<apex:outputPanel id="resultpanel">
Result::{!fetchdata}

</apex:outputPanel>

</apex:pageBlock>
</apex:form>
</apex:page>

 

APEX CLASS

 

public class GetAccountsController
{
String result;
public String getfetchdata()
{
return result;
}

public List<Account> getMyAccounts()
{
return [SELECT Id,Name,Phone,Industry FROM Account Limit 10];
}
public Pagereference invokeService()
{
Id id=System.currentPageReference().getParameters().get('id');
result=[SELECT name from Account where Id=:id].name;
return null;
}
}


 

sailaja.vemparalasailaja.vemparala

Hi.. the below is my code.

I have got the same error messge.

Please, guide me.

 

Program:

 

<apex:page standardController="practice_object__c" id="thePage" extensions="practiceobjectExtension" >
<apex:form >
<apex:sectionHeader title="Add New Practice"/>
<apex:pageBlock mode="edit" id="thePageBlock">
<apex:commandLink value="Go" action="thePageBlock">
</apex:commandLink>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="save" value="Save">
</apex:commandButton>
<apex:commandButton action="cancel" value="Cancel">
</apex:commandButton>
</apex:pageBlockButtons>
<apex:pageBlocksection title="Information">
<apex:inputText >
Location
</apex:inputText>
<apex:inputText >
Hiring Manager
</apex:inputText>
<apex:inputText >
Status
</apex:inputText>
<apex:inputText >
Notification
</apex:inputText>
<apex:inputText >
Start Date
</apex:inputText>
</apex:pageBlocksection>
<apex:pageblocksection columns="1"
title="Department">
<apex:inputText >
Department
</apex:inputText>
</apex:pageblockSection>
<apex:pageBlockSection title="Position Details">
<apex:inputText >
Job Description
</apex:inputText>
<apex:inputText >
Responsibilities
</apex:inputText>
<apex:inputText >
Programming Languages
</apex:inputText>
<apex:inputText >
Educational Requirements
</apex:inputText>
</apex:pageBlockSection>
<apex:pageblockSection id="dependentPositionType"
columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Practice Type" for="pt"/>
<apex:panelGrid columns="2">
<apex:outputText rendered="false">
value=PracticeType
</apex:outputText>
</apex:panelGrid>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

Contorller:

 

public class practiceobjectsExtension {

private final new_dev_setting__practice_object__c po;

public string practiceTypeID {get ; set ;}

public practiceobjectsExtension(ApexPages.StandardController

practiceobjectsController)

{

this.po =

(new_dev_setting__practice_object__c)practiceobjectsController.getRecord();

}

public List<selectOption> PracticeTypeOptions

{

get

{

List<selectOption> practiceTypes = new List<selectOption>();

for (new_dev_setting__practice_object__c JP : [select Electives__c from practice_object__c p where Electives__c  LIKE 'Support'])

practiceTypes.add(new selectOption(JP.id, JP.name));

return practiceTypes;

}

private set;

}

}