I have two radio buttons say radio1 (id=radio1 )and radio2(id=rado2) .On each radio button click I implimented two different a4j:support action (action1 and action2) . There is one phon text field under radio2.So when I am clicking the radio2 button than the phon text filed will get render . But if I click the radio1 , then the radio2 will get diselect and render attribute of the panelGrid will become false.
There is one validator I have written for the phon field.
My problem is for each radio button click the phonValidator is running .
Is there any way out like, I want to call the the phonValidator only when I will click SAVE button ?
Can I get the source ID (of the radio button) under the validate method for which the validate method gets call ?
Here is the validate code :
I do not want to use immediate attibriute of radio1 or radio2.
In general you could use a4j:region, it exists exactly for this purpose. Just wrap some group of elements in a region with an Id and using process attribute in a4j:support you can limit validation just to the desired region or list of regions.
In your particular case just use ajaxOnly="true" in a4j:support and only the parent element's data will be submitted.
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
As you can see all 3 fields are in the same form and all 3 have their respective validators attached (the first two are required, the last one has got a custom validator). So if I try to run some action directly I would fail since the whole form will be validated. In practice, if you do not print the warnings out you would see nothing, just like if the action was just broken. There are two ways to enter the page, as a registered user and as a "mortal" one just setting a temporal nickname.
In most of basic cases when you see that some button or action doesn't work do not rush to scream that this thing is bugged or that the tutorial examples don't actually work. What I strongly recommend is always print your front warnings out while developing a page. To do this just put this component somewhere:
Joined: Jun 03, 2009
Thank you very much for your reply .
But my problem is somthing different that you suggested .
If you have some kind of solution , it will be great for me.
The funtionality is total different .
Here I am using two different radio buttons.When I am clicking the first one it will render and show one text field (email).I am using the email validator here .When I am clicking the secoond one it the first radio button's all fields will get invisible and the email field should also get null.
I only want to validate the email field into the button click.
But the problem is when I am giving an in valid email address and trying to click another radio button it is validating the email field also.
Ye, I understood the desired functionality from the very first post. The example I gave you has the solution. And if you refer to the fact that my example wasn't "your own code corrected" sorry for that.
In my example the first 'Sign in 'button doesn't have ajaxSingle set to true so by default it will try to submit all 3 inputs and fail if any of the three doesn't pass respective validation. Still if you look carefully it's got a process atrribute (which you can use in a4j:support as well) pointing to a region I defined for the 1st two inputs. This way only these 2 will be submitted on button click and the 3rd input will be ignored.
Now, in the same example in the bottom you can see the second event. If I'd just leave it there by default it would also try to submit all 3 inputs. But since it has ajaxSingle set to true the event will be processes for the parent container only and the 1st two inputs will be ignored.
So after all this if you still think that your case is completely different and you have no idea what I'm talking about just use ajaxSingle="true" in both a4j:support components...