close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Validation failing, and loosing data input in checkbox

Thread began 8/27/2013 6:55 pm by Meic Delwedd | Last modified 8/28/2013 10:58 am by Jason Byrnes | 1124 views | 6 replies |

Meic Delwedd

Validation failing, and loosing data input in checkbox

Hi,
In my form is a repeated table area, which outputs checkboxes for each record in a particular table.
In my form I have added validation, where a price has to be inputted as an integer, when the validation fails, using the excellent video tutorial on the site, I have set my form up so for all select and text boxes, the data is retained on the form. However, I cannot do the same with my repeated table checkboxes.
When I try and select the value in dreamweaver to make the field checked/unchecked, the repeated checkboxes do not show in the list of available fields. Presumably because the fields are in a repeated table?
I'm at a loss as to what to do. Will I need to play with the code, or does data assist accommodate this?
Thanks and look forward to your reply,
Aled

Sign in to reply to this post

Meic Delwedd

This is what I have cmome up with so far. Think I'm missing something.

<?php
// RepeatSelectionCounter_2 Begin Loop
$RepeatSelectionCounter_2_IterationsRemaining = $RepeatSelectionCounter_2_Iterations;
while($RepeatSelectionCounter_2_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_2 || $row_WADAMenuarea_key){
?>
<p>
<input type="hidden" name="area_mihidden_<?php echo $RepeatSelectionCounter_2; ?>" id="area_mihidden_<?php echo $RepeatSelectionCounter_2; ?>" value="1" />
<input name="area_<?php echo $RepeatSelectionCounter_2; ?>" type="checkbox" value="<?php echo $row_WADAMenuarea_key['area_key']; ?>" <?php if (!(strcmp($RepeatSelectionCounter_2, (ValidatedField("addnewproperty_246","area")))))
{echo "checked";}
?>/>
<?php echo $row_WADAMenuarea_key['area_name']; ?></p>
<?php
} // RepeatSelectionCounter_2 Begin Alternate Content
else{
?>

Sign in to reply to this post

Meic Delwedd

Hi,

Just in case anyone else has this issue, here is how I've got it to work:

<li>
<label for="property_type">Property Type</label>
<table>
<?php
// RepeatSelectionCounter_3 Begin Loop
$RepeatSelectionCounter_3_IterationsRemaining = $RepeatSelectionCounter_3_Iterations;
$counter = 0;
while($RepeatSelectionCounter_3_IterationsRemaining--){

if ($counter == 4){
echo "</tr><tr>";
$counter=0;
}
$counter = $counter + 1;
if($RepeatSelectionCounterBasedLooping_3 || $row_WADAMenutype_key){
?>
<td><p>
<input type="hidden" name="type_mihidden_<?php echo $RepeatSelectionCounter_3; ?>" id="type_mihidden_<?php echo $RepeatSelectionCounter_3; ?>" value="1" />
<input name="type_<?php echo $RepeatSelectionCounter_3; ?>" type="checkbox" id="type_<?php echo $RepeatSelectionCounter_3; ?>" value="<?php echo $row_WADAMenutype_key['type_key']; ?>" <?php if ((strcmp($RepeatSelectionCounter_3, (ValidatedField("addnewproperty_246","type_" . $RepeatSelectionCounter_3)))) == -1)
{echo "checked";}
?>/>
<?php echo $row_WADAMenutype_key['type_name']; ?></p></td>
<?php
} // RepeatSelectionCounter_3 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_3 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_3 && $RepeatSelectionCounter_3_IterationsRemaining != 0){
if(!$row_WADAMenutype_key && $RepeatSelectionCounter_3_Iterations == -1){$RepeatSelectionCounter_3_IterationsRemaining = 0;}
$row_WADAMenutype_key = mysql_fetch_assoc($WADAMenutype_key);
}
$RepeatSelectionCounter_3++;
} // RepeatSelectionCounter_3 End Loop
?>
</tr>

</table>
</li>

Sign in to reply to this post

Meic Delwedd

Right, ignore the last post, THIS is how I got it to work.

<input name="type_<?php echo $RepeatSelectionCounter_3; ?>" type="checkbox" id="type_<?php echo $RepeatSelectionCounter_3; ?>" value="<?php echo $row_WADAMenutype_key['type_key']; ?>" <?php
if ((strcmp($RepeatSelectionCounter_3+1, (ValidatedField("addnewproperty_246","type_" . $RepeatSelectionCounter_3)))) == 0)
{echo "checked";}
?>/>
<?php echo $row_WADAMenutype_key['type_name']; ?>

Sign in to reply to this post

Jason ByrnesWebAssist

Yeah, you need to include the dynamic variable that controls the checkbox name in the validated entries binding code. glad to hear you found it.

Sign in to reply to this post

Meic Delwedd

Thanks Jason, is how I've done it the correct way? Just want to make sure I haven't "hacked" it too much.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, it looks correct to me.

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