on 2006 Nov 22 10:53 AM
Hello Gurus.
I need to make an attribute of one field dependent of another field value.
For example: INPUT_FIELD_A is disabled when CHECKBOX_B = true
and oposite: INPUT_FIELD_A is enabled when CHECKBOX_B = false.
Possible?
Thank You, LUCAS.
Yes.
bind enabled attribute of INPUT_FIELD_A to a boolean attribute of view context, setting the default you wish.
Create an action -- CHECKBOX_B_CHANGED and bind this action to CHECKBOX_B.
Bind to CHECKBOX_B checked attribute the same boolean atribute of view context.
Inside action code do nothing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK.
I created the action:
name: CHECKBOX_B_CHANGED
text: CHECKBOX_B_CHANGED_ACT
without validation: 0
Event handler: onActionCHECKBOX_B_CHANGED
with parameter :
name: A
type: boolean
I created checkbox:
event --- on toggle CHECKBOX_B_CHANGED
I get this code:
public void onActionCHECKBOX_B_CHANGED(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, boolean A )
{
//@@begin onActionCHECKBOX_B_CHANGED(ServerEvent)
//@@end
}
which i didn't change
But how "bind enabled attribute of INPUT_FIELD_A to a boolean attribute of view context, setting the default you wish.
"?
thx , LUCAS
You wrote first time this:
******************************
Hello Gurus.
I need to make an attribute of one field dependent of another field value.
For example: INPUT_FIELD_A is disabled when CHECKBOX_B = true
and oposite: INPUT_FIELD_A is enabled when CHECKBOX_B = false.
Possible?
Thank You, LUCAS.
*******************************
tell me where mention "100 haracters or more".
So now INPUT_FIELD_A have a properties "value", bind it to another text variable of the context.
Explain better what you wanna.
OK.
Iam explaining:
I hafe a field where I can put some text in it. (100 characters or more) I named it INPUT_FIELD_A.
I also have a checkbox defined close to it. and I named it CHECKBOX_B.
I want this field INPUT_FIELD_A to be in "read only" mode when checkbox is empy.
and I want this field INPUT_FIELD_A not to be in "read only" mode when checkbox is checked.
How can I define thid binding You are writting about?
Thank You, and sorry for misunderstanding.
Ok.
My answer is always the same.
Probably with as i said before, boolean value is inverted for your wish.
Use 2 different boolean variable in the context, one for INPUT_FIELD_A and one for CHECKBOX_B.
Now inside the ACTION that i suggest you put this code:
if (wdContext.currentContextElement().getBOOL_OF_CHECK())
wdContext.currentContextElement().setBOOL_OF_INPUT(false)
else
wdContext.currentContextElement().setBOOL_OF_INPUT(true)
PS:
INPUT_FIELD_A has also a properties "read_only"
Hi Lukasz,
Starting fresh,
Create a boolean attribute, say FieldReadOnly. Attribute : boolean. Calculated : true.
in the getter method of this attribute, give the following
return !wdContext.getCheckboxValue();// ( toggle value from checkbox)
Bind the ReadOnly attribute of the inputfield to this boolean value.
Create an action for checkbox., bind it to the click event of checkbox.
Thats all. When u check the checkbox, nothing will happen in the action, but the calculated attribute value will get calculated and the input field will be input enabled.
Try it,
Regards,
LM
One more time,
step by step.
Let's say I have an input field.
If I mark it like readonly I can't modify it.
But I can only do it by choosing this option in properties of this field.
How can I do it programaticly (lets say I want to assign true as a fixed value).
wdContext.currentContextElement().setINPUT_FIELD.readOnly(false);
????
it gives me an error of course, but why?
You are confusing UIelement from context!
Bind to UIelement properties "readOnly" a boolean attribute (<b>readOnlyATTR</b>) of the context!
And after do:
wdContext.currentContextElement().setreadOnlyATTR(false);
or
wdContext.currentContextElement().setreadOnlyATTR(true);
Message was edited by:
Roberto Tagliento
OK.
I have created this attribute (readOnlyATTR).
Now, how to bind it to INPUT_FIELD property "readOnly"?
by making this INPUT_FIELD property "calculated" = "true", right?
If so, what should i put into this just generated code:
//@@begin javadoc:getINPUT_FIELD(IPrivateEditCard1View.IContextElement)
/**
Declared getter method for attribute INPUT_FIELD of node Context
@param element the element requested for the value
@return the calculated value for attribute INPUT_FIELD
*/
//@@end
public java.lang.String getINPUT_FIELD(IPrivateEditCard1View.IContextElement element)
{
//@@begin getINPUT_FIELD(IPrivateEditCard1View.IContextElement)
return null;
//@@end
}
//@@begin javadoc:setINPUT_FIELD(IPrivateEditCard1View.IContextElement, java.lang.String)
/**
Declared setter method for attribute INPUT_FIELD of node Context
@param element the element to change the value
@param value the new value for attribute INPUT_FIELD
*/
//@@end
public void setINPUT_FIELD(IPrivateEditCard1View.IContextElement element, java.lang.String value)
{
//@@begin setINPUT_FIELD(IPrivateEditCard1View.IContextElement, java.lang.String)
//@@end
}
No.
Create this attribute (readOnlyATTR).
Bind it to INPUT_FIELD property "readOnly".
When you wanna set this UIElemet readable or not readable.
on some action right?
By default for example at wdInit of view do:
wdContext.getcurrentContextElement().setreadOnlyATTR(true);
and at TWO different action do:
this
wdContext.getcurrentContextElement().setreadOnlyATTR(true);
or this
wdContext.getcurrentContextElement().setreadOnlyATTR(false);
Hi Lucas,
Why don't you set the value of the two attributes at the same time? Somewhere you set CHECKBOX_B to true, so there you can set DISABLED_A also and vice versa.
BR,
Christophe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
10 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.