Page 1 of 1

How to set dropdown back to initial state

Posted: Wed Jul 20, 2016 2:52 pm
by MegumiSawada
Hi,

Regarding using dropdown element.
The customer would like to clear the selected dropdown item and set it back to the initial state( which is no item selected).
What is the best way to acheive this?

I was not able to find the way to clear the selected item.
ShowClearButton seems to be not suitable to this case...

I appreciate your kind advice...!

Best Regards,
Megumi Sawada

Re: How to set dropdown back to initial state

Posted: Wed Jul 20, 2016 3:04 pm
by tsupartono
RPG:

Code: Select all

LRNG_AssignNullToProp('/Form.Fields.MYDROPDOWN.Value');
RDML:

Code: Select all

#COM_OWNER.Using Element('/Form.Fields')
#COM_OWNER.Set Property(MYDROPDOWN.Value)  To('')
#COM_OWNER.EndUsing

Re: How to set dropdown back to initial state

Posted: Wed Jul 20, 2016 3:16 pm
by MegumiSawada
Hi Tony,

Thank you for your quick reply.

I'm sorry my question is not clear.
I know how to clear the value, but I don't know where to do this.

The customer would like to clear the value triggered by some user action.
For example, the user chooses one item from dropdown ...then he notices that item shouldn't be selected and would like to set it back to no-item-selected state.
How can we implement this?

Best Regards,
megumi

Re: How to set dropdown back to initial state

Posted: Wed Jul 20, 2016 3:24 pm
by tsupartono
If they want an immediate feedback (after end-user change the value of the drop-down), then they can clear the value in the 'OnValueChange' event handler.

Or if they do a validation on form submit (e.g. they have a submit button), they can clear the dropdown value when selected value is not valid (this would be in the button click handler)

I hope that answers your question.