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
fredbe77fredbe77 

Visualforce Error while performing tutorial from Visualforce Workbook

Hello Everybody,

 

I perform the Visualforce tutorial from this book: Visualforce Workbook.

 

I create Visualforce page and copy/paste the following code in it:

 

<apex:page standardController="Account">
<p>Hello {! $User.FirstName}!</p>
<p>You are viewing the {! account.name} account.</p>
</apex:page>

 

I call the page using the following URL like indicated in the Tuto:

     https://c.na15.visual.force.com/apex/Hello&id=001i0000007fhl9

 

I get the following error message in a blank page:

 

The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores.

 

I get this message even when I change the standardController and comment the account.Name line. No message if I don't use the "&id=001i0000007fhl9" part or the URL.

The environment is completly new (less than 24 hour) and it was the first update I was performing.

 

Has anyone an explanation and possibly a solution to this issue ?

 

Thank very much you for your help

fredbe77

 

Best Answer chosen by Admin (Salesforce Developers) 
Maros SitkoMaros Sitko

I am sorry, I was blind. You must use ? isntead of &. So your URL will be https://c.na15.visual.force.com/apex/Hello?id=001i0000007J9pQ . Because if you define parameters in url, you must devide them from url path - by ?, & is used to devide other paraters for example https://c.na15.visual.force.com/apex/Hello?id=001i0000007J9pQ&hi=true

All Answers

Maros SitkoMaros Sitko
Are you using exist account ID? or is your account name correct? try to create new one with simple name (for example test) and use ID of this account
fredbe77fredbe77

Hello Maros,

 

I've created an Account and picked up its ID (001i0000007J9pQ): same result.

 

It looks like the form "&id=<objectID>" is the cause of the trouble. The error comes even when the code is minimal like this:

 

<apex:page>
</apex:page>

 Thank you for your help

 

Maros SitkoMaros Sitko

I am sorry, I was blind. You must use ? isntead of &. So your URL will be https://c.na15.visual.force.com/apex/Hello?id=001i0000007J9pQ . Because if you define parameters in url, you must devide them from url path - by ?, & is used to devide other paraters for example https://c.na15.visual.force.com/apex/Hello?id=001i0000007J9pQ&hi=true

This was selected as the best answer
fredbe77fredbe77

Oups ! ! !

 

You're right. I made a confusion between the 2 characters.

 

I'm not used to Web programmation.

 

Thank you for your eyes ;-) some sort of "2 are better than 1".