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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Validating Checkbox Group

Thread began 12/11/2009 2:07 pm by christina.elissa4324782 | Last modified 12/14/2009 5:23 pm by Jason Byrnes | 2133 views | 3 replies |

christina.elissa4324782

Validating Checkbox Group

I have added field forms to the contact form solution pack. All is working except:
1. the server validation for the checkbox group will not go away, even when something is checked.
2. the email that is received from the form is not listing the checkboxes. It will only say "Sessions: Array" or "Session: on"

Here is the code I am using in reference to that checkbox group:

$WAFV_Errors .= WAValidateRQ(((isset($_POST["Sessions"]))?$_POST["Sessions"]:"") . "",true,9);

<div id="sessions" class="formInput BoxBorderTop">
<ul class="radioButtons">
<span id="sessions">
<li>
<input type="checkbox" name="Sessions[]" id="All_Sessions" <?php echo((isset($_POST["Sessions"]))?implode(", ", $_POST["Sessions"]):"" ) ?> />
<label for="All_Aessions">All Sessions</label>
</li>
<p class="day">Wednesday, January 20</p>
<li>
<input type="checkbox" name="Sessions[]" id="Wed_Morning_Sessions" <?php echo((isset($_POST["Sessions"]))?implode(", ", $_POST["Sessions"]):"") ?> />
<label for="Wednesday_Morning_Sessions">Morning Sessions</label>
</li>
<li>
<input type="checkbox" name="Sessions[]" id="Wed_Afternoon_Sessions" <?php echo((isset($_POST["Sessions"]))?implode(", ", $_POST["Sessions"]):"") ?> />
<label for="Wednesday_Afternoon_Sessions">Afternoon Sessions</label>
</li>
<li>
<input type="checkbox" name="Sessions[]" id="Wed_Luncheon"<?php echo((isset($_POST["Sessions"]))?implode(", ", $_POST["Sessions"]):"") ?> />
<label for="Wednesday_Lunhceon">Luncheon</label>
</li>
<br class="hide" />
<li>
<input type="checkbox" name="Sessions[]" id="Wed_Dinner" <?php echo((isset($_POST["Sessions"]))?implode(", ", $_POST["Sessions"]):"") ?> />
<label for="Wednesday_Dinner">Reception & Dinner</label>
</li>
<br />
<p class="day">Thursday, January 21</p>
<li>
<input type="checkbox" name="Sessions[]" id="Thurs_Morning_Sessions" <?php echo((isset($_POST["Sessions"]))?implode(", ", $_POST["Sessions"]):"") ?> />
<label for="Thursday_Morning_Sessions">Morning Sessions</label>
</li>
<li>
<input type="checkbox" name="Sessions[]" id="Thurs_Afternoon_Sessions"<?php echo((isset($_POST["Sessions"]))?implode(", ", $_POST["Sessions"]):"") ?> />
<label for="Thursday_Afternoon_Sessions">Afternoon Sessions</label>
</li>
<li>
<input type="checkbox" name="Sessions[]" id="Thurs_Luncheon"<?php echo((isset($_POST["Sessions"]))?implode(", ", $_POST["Sessions"]):"") ?> />
<label for="Thursday_Luncheon">Luncheon</label>
</li>

<span class="checkboxMinSelectionsMsg">Please choose at least one
session you will be attending.</span></span>
<?php
if (ValidatedField("contact","contact")) {
if ((strpos((",".ValidatedField("contact","contact").","), "," . "9" . ",") !== false || "9" == "")) {
if (!(false)) {
?>
<span id="sessionServerError" class="textfieldServerError">Please choose
at least one session you will be attending.</span>
<?php //WAFV_Conditional contact.php contact(9: )
}
}
}?>
</ul>
</div>

Thank you in advance.

Sign in to reply to this post

Jason ByrnesWebAssist

none of the checkboxes has a value:
<input type="checkbox" name="Sessions[]" id="Wed_Morning_Sessions" <?php echo((isset($_POST["Sessions"]))?implode(", ", $_POST["Sessions"]):"") ?> />



should be:
<input type="checkbox" name="Sessions[]" id="Wed_Morning_Sessions" value="Wednesday Morning" />



In the WA_Universal_Email\Templates\contactus.php page, checge:

php:
<?php

foreach( $_POST as $pkey => $pval ){
  if (
$pval != "" && strpos($pkey,"Security_") !== && $pkey != "x" && $pkey != "y")  {
?>
    <div style="formRow">
    <strong><?php echo(str_replace("_"," ",$pkey)); ?>: </strong>
    <?php echo(str_replace("\n","<BR />",$pval)); ?>
    </div>
<?php
  
}
}
?>





to:

php:
<?php

foreach( $_POST as $pkey => $pval ){
  if (
$pval != "" && strpos($pkey,"Security_") !== && $pkey != "x" && $pkey != "y")  {
?>
    <div style="formRow">
    <strong><?php echo(str_replace("_"," ",$pkey)); ?>: </strong>
    <?php if(is_array($pval)) { ?>
    <?php echo(implode(",",str_replace("\n","<BR />",$pval))); ?>
    <?php } else { ?>
    <?php echo(str_replace("\n","<BR />",$pval)); ?>
    <?php ?>
    </div>
<?php
  
}
}
?>
Sign in to reply to this post

christina.elissa4324782

Thank you that worked well for the email and it was simple.

Is there a reason why a php error code will not disappear. In testing some of my fields, the error message will disappear and others will not. I have gone back and forth in turning off JavaScript and turning it back on. I'm not sure if it's a cache thing or what. I have each field to be validated on blur (in the spry) should I be putting that somewhere in the php?

Sign in to reply to this post

Jason ByrnesWebAssist

PHP validation is completely different from spry validation.


The PHP errors are stored in session variables, they will not go away till the browsing session ends or the form is submitted with out an error.

if a spry validation is showing all the time, it because of a problem in the javascript.

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