close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Direction on table join for current options selected?

Thread began 7/18/2013 8:15 am by Justin@AdventDesign | Last modified 7/22/2013 10:29 am by Justin@AdventDesign | 1680 views | 8 replies |

Justin@AdventDesign

Direction on table join for current options selected?

I've got the dataassist insert and update pages working to mark options via a series of checkboxes. The only piece of the puzzle I'm missing is to get the update page to automatically mark the proper checkboxes based upon options that were selected previously. I believe I need to do a query with a table join, and then set the "Check If" item to the results of that query, but my head keeps spinning trying to develop the query. Can someone provide direction on how the query should be written?

Here's the pertinent tables/columns:

tbProducts
- id

optiongroups
- OptionGroupID
- OptionGroupName

options
- OptionID
- OptionGroupID
- OptionName

Update page is attached.

Attached Files
tbProducts_Update.php
Sign in to reply to this post

Jason ByrnesWebAssist

you should be a linking table to assign the options to a product:

productoptions:
productoptionID - primary key
productoptionProductID - relates to tbProducts.id
productoptionsOptionId - relates to options.OptionID

and using the manage relational table behavior to set the options that belong to a product.

see the manage relational table tutorial here:
http://www.webassist.com/tutorials/Manage-relational-tables

Sign in to reply to this post

Justin@AdventDesign

My apologies. I left that table out of the above list, but it does exist and is in use.

productoptions:
ProductOptionID
ProductID
OptionID
OptionGroupID
OptionPriceIncrement

It's been quite some time since I originally developed this page, but I believe I followed a similar tutorial when created and I've combed down through the tutorial you linked and I believe my page is in sync with what has been instructed. Everything works great except for the checkboxes for the options not being checked as they should in the update page. I was thinking I needed another recordset on the update page to pull that existing data, but maybe I'm wrong.

Can you tell me what specific part of the MRT tutorial sets the checked/unchecked status? In the "Step 4: Make the checkbox dynamic" instructions, I see plainly how it writes changes to the DB, but I don't see where it sets the checked/unchecked status on the initial page load.

BTW, here is the specific code pertaining to the repeating checkboxes on the update page in case that helps:

<?php do { ?>
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rsMaterialoptions){
?>
<input type="hidden" name="WADA_RepeatID_OptionID_<?php echo $RepeatSelectionCounter_1; ?>" id="WADA_RepeatID_OptionID_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rsMaterialoptions["OptionID"]; ?>" />
<input <?php if (!(strcmp($row_rsMaterialoptions['OptionID'],1))) {echo "checked=\"checked\"";} ?> <?php if (!(strcmp($row_rsMaterialoptions['OptionID'],WA_AB_returnPreSelectValue($WA_PreSelect_RelationalTable_1, $row_rsMaterialoptions['OptionID'])))) {echo "checked=\"checked\"";} ?> class="checkbox" name="checkbox_<?php echo $RepeatSelectionCounter_1; ?>" type="checkbox" value="<?php echo $row_rsMaterialoptions['OptionID']; ?>" />
<?php echo $row_rsMaterialoptions['OptionName']; ?><br />
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
No records match your request.
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_rsMaterialoptions && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rsMaterialoptions = mysql_fetch_assoc($rsMaterialoptions);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
<?php } while ($row_rsMaterialoptions = mysql_fetch_assoc($rsMaterialoptions)); ?>

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post

Justin@AdventDesign

Replying to private message

Sign in to reply to this post

Jason ByrnesWebAssist

you had a couple problems on the update page preventing it from working:

1) The Update Record server behavior was set to redirect to the results page, this redirect happened before the manage relational table behavior could be triggered.

2) in the forms action you had the id URL variable using the id column, however the id being passed in was the partno column.

Sign in to reply to this post

Justin@AdventDesign

Shoot Jason. I think I just goofed up. Did you make changes to that page from your end? I assumed I needed to make those changes and overwrote what was there.

Sign in to reply to this post

Jason ByrnesWebAssist

See PM

Sign in to reply to this post

Justin@AdventDesign

See PM

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