0

I'm working on a project (Java with XSL/XML) where I have to make the least changes to the already existing code, but I have this scenario and I want to know if it is possible.
Let's say I have this form :

<form method="get">
            <input id="checkbox-has-file" type="checkbox" name="myCheckBox" value="test">
            <input name="" type="submit" value="sup">
</form>

Is it possible to like pre-select the checkbox using only the url parameters, like this :

localhost/page.html?myCheckBox=true

I know it is possible using JavaScript or JQuery, but I'm trying to avoid extra code.

Thank you!

Ivan Vilanculo
  • 648
  • 1
  • 11
  • 25
M.Hamidi
  • 45
  • 10

2 Answers2

1

Without any programming language (JavaScript etc.) it isn't possible.

Raoul Holzer
  • 21
  • 1
  • 3
1

Use PHP:

Here is a sample php file:

<form method="get">
        <input id="checkbox-has-file" type="checkbox" name="myCheckBox" value="test" checked="<?php echo $_GET['myCheckBox'];?>">
        <input name="" type="submit" value="sup">

clabe45
  • 2,354
  • 16
  • 27