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
KravuriKravuri 

Visual force error

Hi,

         I am new to salesforce i am trying to understand visualforce page and apex .I have wriiten piece of code  in visual force without the controller as suggested by the developer book for salesforce but which is giving me error when i tried to save saying it is java.lang.IllegalArgumentException: Illegal view ID !{save}. The ID must begin with /

 

<apex:form >
<apex:pageBlock title="Edit Account for {!$User.FirstName}">
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="!{save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField value="{!account.Start_Date__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
</apex:pageBlock>
</apex:form>
</apex:page>

 

Can someone tell me what am i making mistake in this code.I really appreciate your help.

Best Answer chosen by Admin (Salesforce Developers) 
Devendra@SFDCDevendra@SFDC

Hi,

 

<apex:commandButton value="Save" action="!{save}"/>

 should be rewritten as,

 

<apex:commandButton value="Save" action="{!save}"/>

 

All Answers

Avidev9Avidev9
Can you post your controller?
Seems like the pagereference that is being returned is causing problem
Devendra@SFDCDevendra@SFDC

Hi,

 

<apex:commandButton value="Save" action="!{save}"/>

 should be rewritten as,

 

<apex:commandButton value="Save" action="{!save}"/>

 

This was selected as the best answer
KravuriKravuri

Thanks a lot guys for the replies it really helped.

 

Can someone explain me why are we using the "!{Save}" or why should we use the " ! " mark what does it signify? and sometime they put the "!" mark in the " {} " and sometimes they put outside the braces ..why do we have the differences and when how it has to be used?

Alderete_SFDCAlderete_SFDC

If you have an example of Visualforce code where you see the exclamation mark outside the braces, e.g. "!{ something }", please let us know by clicking the feedback links at the bottom of the HTML version of the topic. It's almost certainly an error.

 

<open brace><exclaimation mark> ... <close brace>, or {! ... }, is the syntax for a Visualforce expression. Whatever is inside those delimiters will be evaluated by Visualforce. Generally speaking, the contents will be either a variable provided to the page by its controller, a controller method call, or a formula of some sort.

 

See the appendices in the Visualforce Developer's Guide for some more details, in the Functions and Expressions Operators appendices sections. You can also review the chapters on controllers for more details of accessing variables on a page, or calling controller methods.

Devendra@SFDCDevendra@SFDC

Hi,