i want to click on a link that takes me to a form, but i also want a behavior that when i click on that link it will automatically check a "checkbox" in my form, its a common form with multiple options, please help
You need to use JavaScript to do this. Give the checkbox that you want to be checked an ID. In the following example, I'm calling it "checkme".
In the link, add a query string with the id like this:
<a href="form.html?id=checkme">Go to form</a>.
At the bottom of the page that contains the form, add the following <script> block just before the closing </body> tag:
<script>
function urlArgs() {
var args = {},
params = location.search.substring(1),
pairs = params.split('&'),
pos, name, value;
for (var i = 0, len = pairs.length; i < len; i++) {
pos = pairs[i].indexOf('=');
if (pos == -1) continue;
name = pairs[i].substring(0,pos);
value = pairs[i].substring(pos+1);
value = decodeURIComponent(value);
args[name] = value;
}
return args;
}
function check(id) {
var checkbox = document.getElementById(id),
args = urlArgs();
for (var name in args) {
if (args[name] == id) {
checkbox.checked = true;
break;
}
}
}
check('checkme');
</script>
The only line that you need to alter is the last one:
check('checkme');
Replace 'checkme' with the ID of the checkbox.
North America
Europe, Middle East and Africa
Asia Pacific