rizwansyed Posted August 11, 2018 Share Posted August 11, 2018 Hi Whenever i click on submit button,It goes to other page as shown in attached figure. Is there any option to automatically press back button of browser or the back option after 1 second as shown in the attached image. Please suggest Thanks and Regards Rizwan Syed Link to comment Share on other sites More sharing options...
davej Posted August 11, 2018 Share Posted August 11, 2018 What are you using as server-side code? Link to comment Share on other sites More sharing options...
dsonesuk Posted August 11, 2018 Share Posted August 11, 2018 Do you need a submit button? Do you even want it to submit? at ALL! Give us a code or link a clue on what you want to happen Link to comment Share on other sites More sharing options...
rizwansyed Posted August 13, 2018 Author Share Posted August 13, 2018 Hi I have a board reneses synergy s7g2 board. Please find the attached Submit button file in html which has a html snippet. I have a list of languages which can be selected from drop down list and then i press submit button so that i can receive the selected language on my board. I have a code in my c file in renesas baord with else if ((NX_HTTP_SERVER_POST_REQUEST == request_type) && (0 == strcmp(resource, "/language"))) It compares with my Html file code like <form action="/language" method="post"> So whenever i press submit button, it goes to other page like 192.100.5.45/language.So i want to avoid going to next page . My requirement is, when ever i submit, it should be in same page or if it goes to other page , i need a workaround like automatically coming back to default page with in a second. Please suggest Thanks and Regards Rizwan Syed submit buttton code.txt Link to comment Share on other sites More sharing options...
dsonesuk Posted August 13, 2018 Share Posted August 13, 2018 ideally you would want to use AJAX https://www.w3schools.com/js/js_ajax_intro.asp it would send form data to wherever in background, without leaving the form. Link to comment Share on other sites More sharing options...
Funce Posted August 14, 2018 Share Posted August 14, 2018 I second AJAX for this one. Otherwise, if you want to end up on the same page for submission, you could: A: Redirect using your back-end code (on your /language page handling, with headers or however you wish to do it) B: Make sure that your form `action` targets the page its on. With this one you'll need to make sure your form handling back-end code also watches this form for submissions. Link to comment Share on other sites More sharing options...
rizwansyed Posted August 16, 2018 Author Share Posted August 16, 2018 Hi We need HTML only, as customer dont need any other language except HTML I have found https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_button_formtarget which uses target="_blank" and posts it in other page. but is any alternative , so that we can avoid going to other page also....just submit and be in same page Link to comment Share on other sites More sharing options...
dsonesuk Posted August 16, 2018 Share Posted August 16, 2018 1 hour ago, rizwansyed said: We need HTML only, as customer dont need any other language except HTML You can't, you at very least require JavaScript, using JavaScript you can use window.onload=function(){ setTimeout(function() { window.location.href = "whereever.html"; //will redirect to your required page }, 1000); } on the page it lands on. The form needs to submit using default method, or JavaScript through AJAX where form values are sent using JavaScript/script code (that can read the post value usually server script such as PHP) as post/get to wherever, to process as it normally would, without the need to leave the form page. Link to comment Share on other sites More sharing options...
Funce Posted August 16, 2018 Share Posted August 16, 2018 13 hours ago, rizwansyed said: Hi We need HTML only, as customer dont need any other language except HTML but is any alternative , so that we can avoid going to other page also....just submit and be in same page Inside `form-page.html` just make the form action the page you're on. That will submit it to the same page. <form action="/form-page.html"> <!-- All the inputs --> </form> Link to comment Share on other sites More sharing options...
rizwansyed Posted August 20, 2018 Author Share Posted August 20, 2018 Hi Funce When I try On 8/17/2018 at 2:24 AM, Funce said: <form action="/form-page.html"> It goes to other page saying enter the name. Thanks and Regards Rizwan Syed Link to comment Share on other sites More sharing options...
dsonesuk Posted August 20, 2018 Share Posted August 20, 2018 That won't work because in that situation it processes (using server side language) the submitted content and depending if it validates it goes on to do other things like redirect, send email etc else It will keep on looping to the same form otherwise. It seems you need to submit to c file located at /language and and retrieve the post data from form. The older html meta redirect is then your only option. <meta http-equiv="refresh" content="1; url=http://whatever/form-page.html">↩ Link to comment Share on other sites More sharing options...
rizwansyed Posted September 4, 2018 Author Share Posted September 4, 2018 Hi Please suggest how to use ajax for submitting the data. Please share a example using AJAX and FORM action Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now