close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

When I apply a MySQLi Manage Relational Table behavior, it is somehow applying an old function

Thread began 4/17/2019 3:29 pm by TroyD | Last modified 4/30/2019 5:21 pm by TroyD | 190 views | 28 replies

TroyD

I've run into a bit of a snag now that I am testing the update of these files. (But I found a solution that is working.)

The behavior is applying correctly in terms of the new code for the preselect, however the MRT update isn’t maintaining or inserting the selected checkboxes.
It deletes all relational records regardless of whether they are selected or not. Not using a multi-select anyway.

So I deleted the multi-select and created a checkbox in a repeat selection instead. Reapplied the MRT to use the new checkboxes, but that did not work either. Records were preselected correctly, but it erased them from the relational table and never inserted those boxes that were newly checked. No errors that I can find.

I then recreated the checkboxes in a repeat region instead of a repeat selection and reapplied the MRT. That worked!

I don’t know if I’m doing something wrong with regards to the multi-select method or the repeat selection method but I wanted to see what your thoughts were. The repeat region checkboxes are fine with me. I can change all of the MRT multi-select pages over to that method, but just in case it would be helpful, I am posting the three methods I tried. The two that did not work and the one that does work.

Multi-select did not work

php:
<select name="u_DepartmentCategory[]" size="6" multiple="multiple" id="u_DepartmentCategory" required>

  <option disabled value>Select Category</option>
  <?php
while(!$rsDepartmentCategories->atEnd()) { //dyn select
?>
  <option value="<?php echo($rsDepartmentCategories->getColumnVal("DepartmentCategoryID")); ?><?php echo(in_array(($rsDepartmentCategories->getColumnVal("DepartmentCategoryID")),$RelationalQuery_1->getSelected())?"selected":""); ?> ><?php echo($rsDepartmentCategories->getColumnVal("DepartmentCategoryName")); ?></option>
  <?php
$rsDepartmentCategories
->moveNext();
//dyn select
$rsDepartmentCategories->moveFirst();
?>
</select>


Repeat Selection checkboxes did not work

php:
<?php

$wa_repeatfor 
= -1// Repeat Selection 1
if (!isset($wa_repeatcount)) $wa_repeatcount 0;
while (!
$rsDepartmentCategories->atEnd() && $wa_repeatfor != 0) {
  
$wa_repeatfor--;
  
$wa_repeatcount++;
if (!
$rsDepartmentCategories->atEnd()) {
?>
  <input type="hidden" name="mrt[]" id="mrt_<?php echo($wa_repeatcount); ?>" value="<?php echo($wa_repeatcount); ?>" />
  <input type="hidden" name="WADA_RepeatID_Parent_DepartmentCategoryID_<?php echo($wa_repeatcount); ?>" id="WADA_RepeatID_Parent_DepartmentCategoryID_<?php echo($wa_repeatcount); ?>" value="<?php echo $rsDepartmentCategories->getColumnVal("DepartmentCategoryID"); ?>" />
  <input <?php echo(in_array(($rsDepartmentCategories->getColumnVal("DepartmentCategoryID")),$RelationalQuery_1->getSelected())?"checked":""); ?> type="checkbox" name="u_DepartmentCategory<?php echo($wa_repeatcount); ?>" value="<?php echo($rsDepartmentCategories->getColumnVal("DepartmentCategoryID")); ?>" id="u_DepartmentCategory_<?php echo($wa_repeatcount); ?>">
<?php echo($rsDepartmentCategories->getColumnVal("DepartmentCategoryName")); ?><br/>
  <input type="hidden" name="WA_RepeatID<?php echo($wa_repeatcount); ?>" value="<?php echo($wa_repeatcount); ?>">
<?php
if ($wa_repeatfor != 0$rsDepartmentCategories->moveNext(); // Repeat Alternate 1
} else {
?>
<?php
// End Repeat Alternate 1
?>
<?php
}
if (!isset(
$wa_startindex)) $rsDepartmentCategories->moveFirst(); // End Repeat Selection 1
?>


Repeat Region. This one works!

php:
<?php

$wa_startindex 
0;
while(!
$rsDepartmentCategories->atEnd()) {
  
$wa_startindex $rsDepartmentCategories->Index;
?>
  <input type="hidden" name="mrt[]" id="mrt_<?php echo($wa_startindex); ?>" value="<?php echo($wa_startindex); ?>" />
  <input <?php echo(in_array(($rsDepartmentCategories->getColumnVal("DepartmentCategoryID")),$RelationalQuery_1->getSelected())?"checked":""); ?> type="checkbox" name="u_DepartmentCategory_<?php echo($wa_startindex); ?>" value="<?php echo($rsDepartmentCategories->getColumnVal("DepartmentCategoryID")); ?>">
  <?php echo($rsDepartmentCategories->getColumnVal("DepartmentCategoryName")); ?><br/>
  <?php
  $rsDepartmentCategories
->moveNext();
}
$rsDepartmentCategories->moveFirst(); //return RS to first record
unset($wa_startindex);
unset(
$wa_repeatcount);
?>



Thanks,
TroyD

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