JavaScript Make the submit button also send an extra value make submit button bigger,make submit button not refresh page,

I have a long form with a submit button that sends the values of all the fields into the address bar.

However, I want the submit button to ALSO add an extra value (&submitted=yes) when it is clicked.

How can I convert my button:

<input type="submit" name="submitted" value="submit">

to do this?

The idea is that I could then use that value in javascript when the page loads along with the other fields:

<script language="javascript">  
var urlParams = new URLSearchParams(window.location.search);
var LastName = urlParams.get('LastName');
var Submitted = urlParams.get('Submitted');
Answer:1

Easiest solution: add a hidden input field to your form.

<input type="hidden" name="submitted" value="yes">
Answer:2

well, you can use button tag instead, just like this:

<button type="submit" name="submitted" value="yes">submit</button>

Also i see that you use language attribute on script, you better use type attribute, like this:

<script type="text/javascript">
</script>
Answer:3

I am trying to reduce an array of objects (config values in my case). My array looks like this: const settings = [ {room: null, key: 'radioEnabled', value: true}, {room: 24, key: 'radioEnabled',...

I am trying to reduce an array of objects (config values in my case). My array looks like this: const settings = [ {room: null, key: 'radioEnabled', value: true}, {room: 24, key: 'radioEnabled',...

How can i display all failures when running tests. test('test case', async (t) => ){ await t.expect(1).eql(2); await t.expect(3).eql(4); } What i get (first failure, then stops): 1) ...

How can i display all failures when running tests. test('test case', async (t) => ){ await t.expect(1).eql(2); await t.expect(3).eql(4); } What i get (first failure, then stops): 1) ...

I've created this function, however when it runs on the website it's designed for it is returning undefined. I did some quick Googling and found that because it's an asynchronous function, it ...

I've created this function, however when it runs on the website it's designed for it is returning undefined. I did some quick Googling and found that because it's an asynchronous function, it ...

I cannot centralize v-radio-group. Here's what I got: <v-container grid-list-md text-xs-center> <v-form ref="form> <div v-if="question.question_type == 'YESNO' "> &...

I cannot centralize v-radio-group. Here's what I got: <v-container grid-list-md text-xs-center> <v-form ref="form> <div v-if="question.question_type == 'YESNO' "> &...