on 04-24-2007 3:46 PM
Hi Guys,
Need some expert advice. I'm doing a check on wdinit whereby if there is no data for 'phone number' a button will get disabled. At the moment the button is set to enabled. How do i programitacilly disable the button? Thanks
Regards
Hi,
you need to do that in WdDoModifyView() method,
dont worry this will get called before view renders in browser
here do this:
lets say phoneNo is your context attribute where user need to fill phone no
if(wdContext.currenContextElement.getPhoneNo()==null)
//hope PhoneNo is of string type
{
IWDButton butObj = (IWDButton)view.getElement("Button1");
//Button1 is the id of button , check out its properties for this
but.setEnabled(false);
//this will make button enable false
}
put this code in modifyview method
hope it helps
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Setting UI element properties by data binding instead of using the setters from wdDoModifyView() has several advantages.
There might be more calls to wdDoModifyView() than you would expect. Using the setter on the UI element will invalidate the view layout such that some clients have to resend the complete view instead of only the changed data.
Armin
Hi Johan
Try this:
1. Create a boolean attribute,say 'enableButton' in your view's context.
2. Assign this attribute to your button's enable property.
3. In your view's wdDoInit method, write:
if(no data in phoneNumber)
wdContext.<currentContextElement>().setEnableButton("false");
This should take care of your button enabling and disabling.
Thanks
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Johan,
You have to create a context attribute, "btnEnable", with the type boolean and bind this attribute with the button's attribute "enabled".
At the wdInit, put this code to disable the button:
wdContext.currentContext().setBtnEnable(false);
Regards,
Luciano
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have to bind the enabled property of the button to a context variable of type boolean. Setting the variable in your code will enable and disable the button.
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.