on 06-18-2009 6:14 AM
Hi,
I am having a requirement where i have a form with 4 fields which are mandatory and one non-mandatory and a SAVE button.I want the save button to be enabled only once all the mandatory fields are filled.So that it get saved in a table.
I have created a context attribute buttonEnabled of the type boolean also added the method to the view.
Now i can see the below method in the view java editor.
public boolean buttonEnabled( ) {
//@@begin buttonEnabled()
return false;
//@@end
}
How should i go about with checking whether the mandatory fields are empty or not.
Request Help..
Regards,
Suvarna
Hi Suvama,
Instead of enabling button after giving data for all 4 mandatory fields it is better to validate the 4 mandatory fields data after clicking the Save button.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suvarna,
If you want to check that all the Mandatory fields are filled then an event should occur when you fill the last mandatory field or the last field on the view. There is a onEnter event for InputField UI element so that when you fill any data in the input area and press enter an event occurs.
So just declare Boolean attribute in the context and and bind the attribute to the enabled property of the button.
So when the user enters the data in the last mandatory input field and presses enter, the onEnter event will occur and in the that event handler check if all the mandatory fields have been filled and if the validation is true set the context attribute value as true. The button will get enabled.
Hope this solves your problem.In case any problem please revert back.
Regards,
Ardhendu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As per my knowledge client side validations are not possible in WebDynpro for Java.
Validation can be done at server side. So for server roundtrip we have to trigger an action.
So without any action you can't control your button enable/disable property through context attribute.
So my suggestion is:
Enable that button all the time.
When user clicks on that button then do the validation for mandatory fields one by one.
If he did not enter value for any mandatory field then you can stop processing your save functionality and you can display the validation message like "Please enter all the mandatory fields".
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.