Change form action when layout responds on a mobile/tablet


I have a responsive layout with a form. the form currently uses a deskop version of the form, however, I would like the form to change to a mobile version of the form when the layout appears on a mobile or tablet.

Is this possible and how would I do this?



I would just use media queries to style the form differently depending on the viewport dimensions.
Or did I misunderstand something?