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

If validation fail retain information for radiobutton

Thread began 7/12/2011 6:57 am by lightwalkercreations361768 | Last modified 7/15/2011 10:09 am by lightwalkercreations361768 | 1108 views | 4 replies

lightwalkercreations361768Beta Tester

If validation fail retain information for radiobutton

Dear WebAssist,

I am having trouble retaining the information on a radio checkbox.

Here is the checkbox code:

<label>
<input type="radio" name="HelpersYes" value="1" id="HelpersYes_0" />
Yes</label>

<label>
<input type="radio" name="HelpersYes" value="0" id="HelpersYes_1" />
No</label>

Very simple submitting a "1" or a "0".
If I bind the form toolkit session "HelpersYes" to the radio button and then I select as my default the DB item I get this:

<label>
<input <?php if (!(strcmp($row_SavedReportRs['HelperYes'],"1"))) {echo "checked=\"checked\"";} ?> type="radio" name="HelpersYes" value="1" id="HelpersYes_0" />
Yes</label>

<label>
<input <?php if (!(strcmp($row_SavedReportRs['HelperYes'],"0"))) {echo "checked=\"checked\"";} ?> type="radio" name="HelpersYes" value="0" id="HelpersYes_1" />
No</label>


Which is only using the DB record to select the default. but not the validation session.

If I just bind the form toolkit session "HelpersYes" without selecting anything as the default I do get the session creating the default. see below.

<label>
<input <?php if (!(strcmp((isset($_SESSION["WAVT_dailycurrent_507_Errors"])?ValidatedField("dailycurrent_507","HelpersYes"):""),"1"))) {echo "checked=\"checked\"";} ?> type="radio" name="HelpersYes" value="1" id="HelpersYes_0" />
Yes</label>

<label>
<input <?php if (!(strcmp((isset($_SESSION["WAVT_dailycurrent_507_Errors"])?ValidatedField("dailycurrent_507","HelpersYes"):""),"0"))) {echo "checked=\"checked\"";} ?> type="radio" name="HelpersYes" value="0" id="HelpersYes_1" />
No</label>

This also works fine but I need to include the default from the DB if the session "HelpersYes" is not there.

I have tried combining the two but without success. see below:

<input <?php if (!(strcmp((isset($_SESSION["WAVT_dailycurrent_507_Errors"])?ValidatedField("dailycurrent_507","HelpersYes"):""),"1"))) {echo "checked=\"checked\"";} elseif (!(strcmp($row_SavedReportRs['HelperYes'],"1"))) {echo "checked=\"checked\"";} ?> type="radio" name="HelpersYes" value="1" id="HelpersYes_0" />
Yes</label>

<label>
<input <?php if (!(strcmp((isset($_SESSION["WAVT_dailycurrent_507_Errors"])?ValidatedField("dailycurrent_507","HelpersYes"):""),"0"))) {echo "checked=\"checked\"";} elseif (!(strcmp($row_SavedReportRs['HelperYes'],"0"))) {echo "checked=\"checked\"";} ?> type="radio" name="HelpersYes" value="0" id="HelpersYes_1" />
No</label>

Is this a bug? How can I write the code so that on the radio button it will use the session as the default if there is a session, if not it will use the value from the DB.

I have checked to make sure the DB values are correct so it is something missing in the code and I do not know enough to fix it. Please can you help.

Many thanks as always

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