Here's a different approach altogether to use that requires no code
- Create a custom formula field called 'Alerts'
- Add to a section with 1 column - and don't display header on edit or view
- Use the following formula pattern (done on an Opportunity)
The example will display a little red/yellow/green flag plus text whenever either field Foo__c is empty/'TBD' or the parent Account is missing the market/geo/region/billingCountry.
The approach has limitations in that the formula field can't be more than 5000 characters compiled but for a limited set of soft alerts, it works great and can be customized point-and-click
/* Form of an alert is a set of concatenated strings as follows:
IF(<condition 1>,
IMAGE("/img/samples/flag_yellow|red|green.gif" , 'Yellow|Red|Green' ,12,12) & ' alert text with leading space' & BR() ,
NULL
) &
next condition as above for second alert */
IF (OR(ISPICKVAL( Foo__c,"TBD"),ISPICKVAL(Foo__c,"")),
IMAGE("/img/samples/flag_yellow.gif" , 'Yellow' ,12,12) & ' Foo is not set to Yes or No' & BR(),
NULL)
&
IF (OR(ISPICKVAL( Account.Geo__c, ""),
ISPICKVAL(Account.Market__c,""),
ISPICKVAL( Account.Region__c , ""),
ISBLANK(Account.BillingCountry)),
IMAGE("/img/samples/flag_red.gif" , 'Red' ,12,12) & ' One or more of Account Geo/Region/Country/Market is blank. Update on the Account tab. Required for reporting' & BR(),
NULL)
Here's an example (redacted) from one of my standard page layouts
rendered="{! ISBLANK(Event_Cost__c.Account__c) }"
; your present code seems to be checking to see if the value is a single character string containing a space.