How can i write an action

Hi,
I have form when i click on a button it need to change the selection value as 2 on onclick action or is there any other process.
Thankyou.