Radio button values being wiped upon validation?
I have a form with two sets of radio buttons. I've got validation on the form set to check various fields and when the form is submitted, and validation fails, I can retain the value entered by the user, rather than it being wiped which is does by default, using the following code:
<input name="formEMAIL" id="formEMAIL" type="email" class="form-control" placeholder="Please enter your e-mail address..." maxlength="70" value="<?php echo(ValidatedField("joinTMSAconfirm_085","formEMAIL")) ?>">
However, when I try to set this up for my radio buttons:
<div class="radio">
<label>
<input type="radio" name="formRECEIVE" id="formRECEIVE1" checked value="<?php echo(ValidatedField("joinTMSAconfirm_085","formRECEIVE")?ValidatedField("joinTMSAconfirm_085","formRECEIVE"):"Yes") ?>"> Yes
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="formRECEIVE" id="formRECEIVE2" value="<?php echo(ValidatedField("joinTMSAconfirm_085","formRECEIVE")?ValidatedField("joinTMSAconfirm_085","formRECEIVE"):"No") ?>"> No
</label>
</div>
...it doesn't work.
So, this is because no matter what happens "checked" is always selected for the first radio button because I don't have it as part of the validation check/specification.
I need to acheive the following:
1) On very first load of the form, before it has been submitted by the user, I need the "Yes" value to be selected by default (checked).
2) When the user submits the form and validation fails then I need whatever selection they made from the radio buttons to remain checked, not set back to the default.
Thank you.
NJ