Avoid problems in key-controlled HTML forms if key is permanently pressed - html

I created a simple web application with two pages. For a better usability I make it key-controlled, which leads to a problem. This is the workflow:
A form in which pressing ENTER key (or a button) executes the submit. This starts a database query.
The second page then displays the query result; a "Back to start" button calls the form again. The form is refilled with the same values again. The button can also be activated by ENTER.
The problem occurs when a user permanently press the ENTER key. Then dozens of querys are executed and this nearly kills the application.
Any ideas how to handle this without losing comfort? Thx

If you are using any server-side language like PHP or similar, you should add a flag to the user session which indicates whether the form has been submitted previously. You can also count the number of submits if you want the form to be submitted multiple times but not infinite.
If that doesn't fit your needs, please describe your execution environment more precisely.

Related

How can I prompt a user to confirm before submitting an Action?

I am trying to configure an action in the ontology manager application. This action edits objects that are currently used in production, so we need to make sure that users to not accidentally submit actions. As such, I would like to configure an extra pop up that will ask the user for explicit confirmation before the action submission goes through. Is this possible? Ideally it would look something like the confirmation popup that is shown by Foundry when you try to delete a dataset (see screenshot below).
Within the action form you could add another parameter asking the user to confirm with a specific word (e.g. 'I Acknowledge') that they really want to make those changes. I drafted this up in a Workshop app.

MS Access - Prevent prompt to save form

Sometimes when I've made changes to the form via VBA (change in record source, control source, making controls visible or not, etc.) the user will be prompted to save the form when closing it.
Is there any way to avoid this or prevent the prompt?
Im posting in the answer section because I'm unable to post under comments, I'm Relatively new to this site.
Anyways, are you making the changes while other users may be using the form at the same time? That's the only thing that would make sense to me is that a user is in the form when you are making your changes which it then asks them to save the changes to the form, as it would be different from the time they first entered into the form.

Detecting Double click with javascript disabled

I have a action being performed on a button click for a page with no javascript, but I want to prevent that action being performed twice when a user double clicks.
You need to store, using your form handler code, the submitted data from each request (at least for a little while) and then compare each set of submitted data to previously submitted data.
You can either do this across the entire set of data (which is more complex) or generate an ID token each time you create a form, store it in a hidden input, and compare only that (but then you may reject a deliberate second submission by someone who submits the form, hits back, changes the data in the form and makes another request).

How to submit a form without Javascript and not by pressing any buttons?

How can we submit a form without Javascript and not by pressing any buttons?
I need to transfer a content to another file when a function works under certain conditions. Both the files are written in Perl. The pages are loaded in a webserver(same). I need to transfer a value, which the user doesn't want to know what I'm sending. So I came up with the post method is safe.
But there I didn't find any ways to redirect a URL where the values are transmitted in post method. So I came up with the form submission. But the problem is I need to use javascript or make user to press a button to complete the task.
The problem with Js is there some users who disable JS in their browsers.
So using it is not preferable. With the button,
I can't make the user to do that for me.
Is there any other scripting language, which supports such functionality?
There are some conditions that I can't use session
What I did is encryption for identifying the user from knowing what data is transmitted. The receiving page will decrypt it when it is required. But it's not what I needed.
I need to transfer a value, which the user doesn't want to know what I'm sending. So I came up with the post method is safe.
It isn't. If you pass it through the user's browser, then the user can see it.
Is there any other scripting language, which supports such functionality?
No. There is no programming language as well supported in browsers as JavaScript, and none that are harder to disable then JS.
Store the value on the server (you could use a session) and redirect the user with a normal 302 status and Location header. You can pass a session token via cookies or the query string.
You can't make a user do anything, unless you're writing for a browser the equivalent of a trojan.
But secondly, without something on the client side, you can't ensure that you can get information that you didn't have when you sent the page.
You could place some links, and know which links they clicked on by passing it through a central tracking program, but those links wouldn't have anything in them that didn't originate on the server without client script running.
Still, despite that you can entice a user to click on a link more than a simply functional button, in either case you can't get guaranteed new information from them. They can always close the tab, close the browser, or press the back button. This goes back to point #1: you can't make users do anything.

Have form do two things on submit

Hey, I'm just wondering if it's possible to have a form in html do two things on submit, have the action go to a url like normal (for a search) but also run a mysql command.
Thanks!
A form can not run any SQL. HTML has nothing to do with databases, it doesn't know about them, it can't talk to them.
A script on your server can do SQL queries, and that script can be invoked by the browser request. The browser may also submit form data together with the request if it wishes.
It works like this:
User submits form
Browser generates a request and sends it to the given URL
Server receives request, starts up script corresponding to the URL
Script queries database, does something with the received form data
Script outputs some reply
Browser receives reply (website) and displays it
Stop. Never have a client ever run a MySQL (or any database) command. They could do a lot to seriously destroy the integrity of your database. You should have your processing page do the MySQL command after validating the input.
To answer your question, however, it is possible. Your form, upon submit, can call a Javascript function, which in turn does the two actions. But if you're doing this, there's probably some code that needs to be refactored.
I think you have a couple of options here. If your page requires javascript to be enabled for them to submit the form, then you could do an synchronous XMLHttpRequest call before the form submission. If you don't know if Javascript is enabled on the browser or there is a chance that someone can turn it off, then you would need to perform the two actions on the server after they submit the form.