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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Can I add a radio button or check box

Thread began 1/12/2010 12:15 pm by di5856 | Last modified 4/27/2010 10:07 am by Jason Byrnes | 2086 views | 15 replies |

di5856

Can I add a radio button or check box

I would like to add a radio button or check box for the user to check if they would like to receive their newsletter by e-mail. Can I do this, and if so, how?
THANKS!

Sign in to reply to this post

Jason ByrnesWebAssist

You would need to have DataAssist in order to modify the Insert Record behavior to store the value of the new check box or radio button.

You just need to add the checkbox or radio button to the registration form, make sure to give it a checked value.


In the users table, you need to add a new column.

Then Edit the insert record server behavior on the registration page to bind the new checkbox to the new database column so it's value will be stored.

Sign in to reply to this post

di5856

Thanks Jason!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Larry

Adding Radio buttons

Jason, I have added radio buttons to the User Registration page for receiving our newsletter. Also added the appropriate field to the database, and all works well.

The problem I am having is adding the same radio group to the user_Profile page in case the user wants to change and either receive or not receive our newsletter. What is happening is if the user changes their option from yes to no, or no to yes, it just erases the value in the database instead of changing the value to yes or no.

Also what needs to be done to show what the user has selected on their profile page.

I hope I explained the in enough detail.

I also would like to add the same radio group to the admin users_Update page.

Larry

Sign in to reply to this post

Jason ByrnesWebAssist

make sure that you have given each radio button a checked value.


In design View, click the radio button, in the property inspector, edit the checked value option to the value that should be stored in the DB if that radio is checked.


to set the initial state, click the dynamic button in the property inspector, then click the lightning bolt next to Select Value Equal to and select the column that corresponds to the radio button from the recordest.

Sign in to reply to this post

Larry

Jason,

Thank you very much, that worked perfect, after I figured out I had my database set up wrong. After making the needed corrections, that works perfect.

One more question please. How would I put a field on the users_profile page notifying the user if they are currently subscribe or not currently subscribed? Since now it is enter in the database correct.

Sorry for all the easy dumb questions, but I am still learning and the more I learn about the WebAssist products the easier it seems to manage this website.

Larry


Originally Said By: Jason Byrnes
  make sure that you have given each radio button a checked value.


In design View, click the radio button, in the property inspector, edit the checked value option to the value that should be stored in the DB if that radio is checked.


to set the initial state, click the dynamic button in the property inspector, then click the lightning bolt next to Select Value Equal to and select the column that corresponds to the radio button from the recordest.  
Sign in to reply to this post

Jason ByrnesWebAssist

for that you need to create a php if statement that evaluates the value being stored in the database.



php:
<?php if($row_RecordsetName['SubscribeColumn'] == "<subscribe value>") { ?>
You are subscribed
<?php } else { ?>
you are not subscribed
<?php ?>




Note, this is sample code. Substitute "RecordsetName", "SubscribeColumn" and "<subscribe value>" with the correct name for your recordset, the subscribe column and the subscribe value.

Sign in to reply to this post

Larry

Hi Jason,

In the Bindings panel under the Recordset name is: subscribeYes The column name in the database is: subscribeYes And the value is: y.

So using those values with the php you provided as below, I get a parse error and the line listed for the parse error is the very last line of code in the page.

<?php if($row_SubscribeYes['SubscribeYes'] == "<y>") { ?>
You are subscribed
<?php } else { ?>
you are not subscribed
?>

Any ideas why I would get the parse error, and why way at the bottom of the page.

Larry

Sign in to reply to this post

Jason ByrnesWebAssist

  Recordset name is: subscribeYes The column name in the database is: subscribeYes And the value is: y.  




you say the rs name is "subscribeYes" and the column name is "subscribeYes" (lower Case leading "s")

PHP is case sensitive so the code should be:
<?php if($row_subscribeYes['subscribeYes'] == "y") { ?>

if that doesn't work paste the exact error into your response and include a copy of the page in a zip archive so I can see the exact line number.

Sign in to reply to this post
loading

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