close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Radio Buttons update code

Thread begun 7/29/2013 11:01 am by iainmacdonald331081 | Last modified 7/29/2013 12:48 pm by Jason Byrnes | 1149 views | 5 replies |

iainmacdonald331081

Radio Buttons update code

Just using some radio buttons which I don't often, and can't seem to get the syntax quite right on my update page, where the currently selection should show as checked.

What I have at the moment is:

<label class="radioSublabel_Narrow" for="Publication_Type__1">
Public&nbsp;<input type="radio" name="Publication_Type" id="Publication_Type__1" value="<?php if (!(strcmp($row_WADApublications['Publication_Type'],"Public"))) {echo "checked=\"checked\"";} ?>" class="formRadioField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("publicationsupdate","Publication_Type"):"".$row_WADApublications["Publication_Type"].""),"1"))) {echo "checked=\"checked\"";} ?> tabindex="1"></label>
<label class="radioSublabel_Narrow" for="Publication_Type__2">
Private&nbsp;<input type="radio" name="Publication_Type" id="Publication_Type__2" value="<?php if (!(strcmp($row_WADApublications['Publication_Type'],"Private"))) {echo "checked=\"checked\"";} ?>" class="formRadioField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("publicationsupdate","Publication_Type"):"".$row_WADApublications["Publication_Type"].""),"0"))) {echo "checked=\"checked\"";} ?> tabindex="2"></label>

With that, neither box shows as checked, but it if the value of 'Publication_Type' is 'Public' the first one should be checked, and if the value is 'Private' the second one should be checked. So I assume I just haven't got the syntax for the value right?

EDIT: OK, think I've got it - changes in bold below:

<label class="radioSublabel_Narrow" for="Publication_Type__1">
Public&nbsp;<input type="radio" name="Publication_Type" id="Publication_Type__1" value="<?php if (!(strcmp($row_WADApublications['Publication_Type'],"Public"))) {echo "checked=\"checked\"";} ?>" class="formRadioField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("publicationsupdate","Publication_Type"):"".$row_WADApublications["Publication_Type"].""),"Public"))) {echo "checked=\"checked\"";} ?> tabindex="1"></label>
<label class="radioSublabel_Narrow" for="Publication_Type__2">
Private&nbsp;<input type="radio" name="Publication_Type" id="Publication_Type__2" value="<?php if (!(strcmp($row_WADApublications['Publication_Type'],"Private"))) {echo "checked=\"checked\"";} ?>" class="formRadioField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("publicationsupdate","Publication_Type"):"".$row_WADApublications["Publication_Type"].""),"Private"))) {echo "checked=\"checked\"";} ?> tabindex="2"></label>

Although its not updating with the new value if I change it...

Sign in to reply to this post

Jason ByrnesWebAssist

there is no value attribute for the radio buttons:

value="Private"

or:
value="Public"

Sign in to reply to this post

iainmacdonald331081

So if I change it to:

<label class="radioSublabel_Narrow" for="Publication_Type__1">
Public&nbsp;<input type="radio" name="Publication_Type" id="Publication_Type__1" value="Public" class="formRadioField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("publicationsupdate","Publication_Type"):"".$row_WADApublications["Publication_Type"].""),"Public"))) {echo "checked=\"checked\"";} ?> tabindex="1"></label>
<label class="radioSublabel_Narrow" for="Publication_Type__2">
Private&nbsp;<input type="radio" name="Publication_Type" id="Publication_Type__2" value="Private" class="formRadioField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("publicationsupdate","Publication_Type"):"".$row_WADApublications["Publication_Type"].""),"Private"))) {echo "checked=\"checked\"";} ?> tabindex="2"></label>

It will update, but then both buttons appear as unchecked on the update page. What do I need for the button of the current value to appear checked on th update page?

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post

iainmacdonald331081

Sorry Jason - just double checking it, and it is working now. Must have been one of those ones where I had all the bits right, just not at the same time until now. Thanks again for having a look.

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear it is working.

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...