Pre-check checkbox onload based on previous message

Hi,

I am creating a form in which a checkbox is checked based on the info from previous page.

The info I am passing is the client ID (which is a number I can pass in the URL variable)

In the form I have a list of clients (with checkboxes next to them)

Now if you come from a specific client page the checkbox with the client name should be already checked since you are getting info regarding that client, with the option of selecting other clients…

So any idea on how I can accomplish this using Javascript?

Regards

Javascript is not the right tool for this job.
You should submit the first form to a server-side script, such as PHP, so that the server-side script can then build the next page with information from the previous page.

If however you insist on using JavaScript, your form is highly likely to fail. JavaScript is completely optional, and you need to understand that it should not be used for any fundamental behaviours.
Having said that, here is code to access the querystring via JavaScript.

JavaScript can only access forms that are submitted via “get”. Forms that are submitted via “post” are not in any way accessible via JavaScript. You come back to requiring server-side code for such requirements.