How can i set a hidden form value using onclick?

I have a form with multiple submits and each one needs to set a hidden form value to a different value. I guess i can do this with an onclick, but have failed so far to discover any code that might do this.

Can someone point me in the right direction?


<input type="hidden" name="thingy" value="" />

...

<input type="submit" value="submit1" onclick="document.forms[0].elements['thingy'].value = 'submit1 clicked';return true;" />
<input type="submit" value="submit2" onclick="document.forms[0].elements['thingy'].value = 'submit2 clicked';return true;" />