raspucin_22
raspucin_22

Reputation: 35

How to make submit form which goes to the same page in Joomla

I am making form with submit button in Joomla custom HTML and I would like to stay on the same page after I click on the submit button.

Is that possible? Thanks in advance.

Upvotes: 1

Views: 2631

Answers (2)

Martin
Martin

Reputation: 10563

Just leave the form action attribute out. This will post back to the same page. Have a look at this question and answer: Is it a good practice to use an empty URL for a HTML form's action attribute? (action="")

Upvotes: 1

Ahti
Ahti

Reputation: 1430

If "stay on the page" means that the page will not reload, or anoter page will be loaded, yes, thats quite possible. I think the best way of doing this is replacing the <input type=submit> with a <button>, which calls a javascript function that evaluates the form, submits the data via ajax, and notifies the user that the form was successfully submitted.

Upvotes: 0

Related Questions