I am working in the confines of a CMS system, which defines certain fields which can be used to make forms for use within the application in PHP.
The list function has the signature:
function inputBasicList ($id,$value = "",$list = array(), $displayName = NULL, $displayLabel = true)
I use it thusly:
$theinput = new inputBasicList("type",$therecord["paymenttype"],array("Cash"=>"cash","Credit"=>"credit"), "Payment Type");
Likewise, there is a checkbox, which has the signature:
function inputCheckbox($id,$value = false, $displayName = NULL, $disabled = false, $displayLabel = true)
I use it thusly
$theinput = new inputCheckbox("paid", $therecord["paid"], "Paid");
What I would like to do, is if the list is set to credit instead of the default cash, to automatically set the checkbox to true/checked.
I don´t think the CMS system allows a way to do this using any built in functions, and am wary of adding any javascript.
Is such a thing possible with just PHP?
Otherwise, how complicated would the javascript have to be to do such a thing?
edit:
The generated HTML from the phpBMS forms
<p class="big"><label for="type" class="important">Payment Type</label>
<br />
<select name="type" id="type" class="important" >
<option value="cash" >Cash</option>
<option value="credit" >Credit</option>
</select>
</p>
<p class="big">
<input type="checkbox" id="paid" name="paid" value="1" class="radiochecks" />
<label id="paidLabel" for="paid" >Paid</label>
</p>