I usually just get it using a call to arg(1) in the from rendering function.
This makes your form definition function dependent on where it is rendered.
What about ... 'path' => 'somepath/'.arg(1).'/'.arg(2), 'callback' => 'drupal_get_form', 'callback arguments' => Array('my_form',arg(1), arg(2)),
I don't understand you, Ivan. Using:
'path' => 'somepath',
and then calling arg(1) will yes only work at a URL of the form:
somepath/x
but your solution also only will work at a URL of the form:
somepath/x/y
I don't see any difference--on the contrary, using arg(1) etc. seems more flexible, because then I can always access arg(3) without worrying about adding to my callback arguments.
Perhaps I am not understanding you correctly.
Thanks