質問

I have a VisualForce page that has three functionalities, Hence it has three 'public PageReference' subroutines, That are called when an action happens in the page [i.e. button]

One of the functionalities requires user input [i.e. inputText], So the main APEX code has a variable declaration for that input:

public String UserInput { get; set; }

Since each task is not really related, When I hit the button on the other two functionalities, I get a VisualForce error, Because the inputText object has no user input,

How can I prevent that from happening,

Another way to solve this, How do I turn off VisualForce Error messages? So I can do error handling from APEX, Looking at the debug log file, The error is in VisualForce NOT APEX,

Thanks

役に立ちましたか?

解決

If you don't want to fire validation you can use the immediate = true attribute on the CommandButton/CommandLink to bypass any validation. - This isn't optimal in my opinion

If you only want to submit part of a page and still fire validation have a look at the ActionRegion. This should allow you to wrap a particular Region for the action call. This is probably best for your purpose.

Sorry I don't have time to post full examples but that should point you in the right direction :)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top