If I have a form with the following 3 fields:
First Name Last Name Date Of Birth
When the user fills in all 3 fields and submits you will get the URL
http: //fakeURL.php?firstName=Fred&lastName=Flintstone&DateOfBirth=2/5/1952
However, if the user only fills in First Name and Date Of Birth you will get
http: //fakeURL.php?firstName=Fred&lastName=&DateOfBirth=2/5/1952 (where lastName has no value)
How do I achieve
http: //fakeURL.php?firstName=Fred&DateOfBirth=2/5/1952 (where lastName and value are removed from the URL)
I don't want to disable the input field upon using onsubmit. Is there a better way than disabled the input field?
Please help...
The Javascript uses jQuery to change the DOM depending on the selections made. Essentially, depending on the conditions of a field answer, you can bulk turn show/hide other components of the form. For validation purposes, some extra attributes are changed depending on the selection.
Just remove the "name" attribute from the input element.
// using jQuery
$('#inputId').removeAttr('name');
// native Javascript
document.getElementById('inputId').removeAttribute('name');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With