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
gm_sfdc_powerdegm_sfdc_powerde 

Changing the display name of inputField in validation error

I have an inputField in a form that needs to use a different name than the field that it is bound to.  I was able to achieve this by using a outputLabel component tied to inputField using "for" attribute.  However, when the form is submitted without filling this field (a picklist),  the error message which is displayed shows the field name and not the name defined by outputLabel.  How can I fix this problem?

 

 

wesnoltewesnolte

Hey

 

The name is bound the field and therefore the validation that is happening, so your method cannot work. If you are using an Apex controller or extension though you can perform the validation yourself via the code, and then the message can say whatever you wish it too. If this is your case give me a shout and I'll help you out.

 

Cheers,

Wes 

gm_sfdc_powerdegm_sfdc_powerde

Thanks for your reply!

 

yes, I am using an extension.   Are you suggesting that  I use selectList and do the validation myself in the extension?  If that is the case, I see 2 problems with that -

 

1) I have a bunch of other input fields for which I am relying on the platform to do the validation and render errors using the standard error display mechanism (standard red pointer and a message below the input field).  Is there a way I can get a similar error display with custom validation?

2) Standard input fields are validated earlier in the request lifecycle and therefore control does not go to my controller if there are errors with other input fields. Is there a way to have standard and custom validations to happen together?

 

 

 

 

wesnoltewesnolte

Hmmm, I see you point(s).

 

1) You can but not without massive difficulty.

2) In all honesty I'm not sure but my guess would be no.

 

Sorry bud. I used custom validation exclusively.. mixing and matching is probably not the best of ideas. One more question though, do you use the 'normal' name of the field in other areas of your app?

 

Cheers,

Wes

gm_sfdc_powerdegm_sfdc_powerde

Wes, thanks a lot for your reply.  You confirmed my fears and I now have to make them all custom validations or live with the problem that I have.  I guess the latter is better. 

 

To answer your question, the normal name is indeed used in other parts of the app.  This particular vf page is part of a customer portal and there is a business requirement to use a different term that makes more sense to our customers.  Thanks a lot for your help!