Skip to main content Trailblazer Community は 2025/2/1 から 2025/2/2 まで使用できなくなります。適宜、活動を計画してください。
エラー

問題が発生しました。もう一度お試しください。

I have a visualforce page and a custom controller

vf page have a form and required fields and i'm validating it throught <apex:inputtext value="{!data}" required="true">

my question is do I need to validate it in my controller also?

like if

if(data == Null || data == ''){

pexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'my error message'));

}

i'm really confused about it.

please help.

 
3 件の回答
  1. 2020年2月29日 9:35
    Hi Mahesh,

    The simple answer is if you've marked it as required on VF page then it will be required field and you need no to handle on controller side.

    But just imagine a situation, where you want to reuse same controller on the other VF page. If you don't want that field to be  as required on that VF page don't use this attribute.

    So, it depends on you're requirement.

    Thanks,

    Ashish Singh.
0/9000