Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is meant by action="#main_body" in a HTML form

I have form and some fields and I want send these fields to the next page via done.php using action="#main_body".

What are the differences between these two forms?

<form id="formElem" name="formElem" action="/ifs/form/index.php" method="post">

<form id="formElem " class="ifs"  method="post" action="#main_body">
like image 489
user1122910 Avatar asked Dec 22 '22 04:12

user1122910


1 Answers

The complete action of the form is the URL of the page containing the form at the time of loading the form + the hashtag. So submitting the form will load the same page, but with a ahashtag (anchor) of #man_body. This is a side effect of action attributes being realtive if not definitly given as absolute.

Please be aware, that it is browser-dependant and header-dependant wether the page will actually reload or just scroll.

like image 186
Eugen Rieck Avatar answered Dec 24 '22 01:12

Eugen Rieck