I have an HTML form on a web page. I want to send users an email with a URL that they can click to fill out the form. I want to pre-populate the value of a radio button group using URL parameters only.
The platform I am using does not allow me to do any scripting of any kind. I need to do this using only the URL parameters.
This is trivial for other types of input tags. For example, if I have a page called form.html
and within that page I have an input
tag as follows:
<input name="firstname" type="text">
Then I can use the following URL to pre-populate the field with the value "James":
http://form.html?firstname=James
What I am looking for is how to do this with a radio button. For example, let's say my page form.html
has a radio button group with three options as follows:
<input name="status" type="radio" value="New">
<input name="status" type="radio" value="Expired">
<input name="status" type="radio" value="Renewed">
How do I pre-set the value of this radio button group with a URL parameter?
I have tried the following:
http://form.html?status=Expired
But this doesn't work. Is there any way to do this without JS or JQuery? You may think I can just set the value I want to be selected by default using the checked=true
attribute in the HTML itself, but the problem is that the value I want to pre-populate is different depending on the user, so I need to set it in the URL parameter.