close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Radio button values being wiped upon validation?

Thread began 7/28/2015 6:18 am by Nathon Jones Web Design | Last modified 7/28/2015 5:18 pm by Ray Borduin | 123 views | 1 replies |

Nathon Jones Web Design

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

Sign in to reply to this post

Ray BorduinWebAssist

php:
<div class="radio">

<label>
<input type="radio" name="formRECEIVE" id="formRECEIVE1" value="Yes" <?php echo((ValidatedField("joinTMSAconfirm_085","formRECEIVE") == "Yes" || ValidatedField("joinTMSAconfirm_085","formRECEIVE") == "")?"checked":""?>"> Yes
</label>
</div>

<div class="radio">
<label>
<input type="radio" name="formRECEIVE" id="formRECEIVE2" value="No" <?php echo((ValidatedField("joinTMSAconfirm_085","formRECEIVE") == "No"?"checked":""?>"> No
</label>
</div>
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...