close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Repeating Tables & Radio (group) buttons

Thread began 6/03/2015 1:15 pm by Paul | Last modified 6/03/2015 11:12 pm by Paul | 646 views | 0 replies

PaulBeta Tester

Repeating Tables & Radio (group) buttons

I've created a repeating table that returns images belonging to a logged in user.

Each row features a check box and radio button which is used to select which images are active and the radio to assign a single image as the primary image. I'm using WA update multiple records to achieve this.


The checkboxes work fine, however the radio button is partially working. Unfortunately it is not allowing a single selection as you would expect in a radio group. They are behaving as checkboxes.

Heres the form code:

<form name="ManageUsrImgFrm" method="post" action="<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>" >

<table width="100%" border="1" cellspacing="2" cellpadding="2">
<tr>
<th scope="col" width="180px">Thumbnail</th>
<th scope="col">Tag</th>
<th scope="col">Active</th>
<th scope="col">Amend</th>
<th scope="col">Delete</th>
<th scope="col">Primary</th>
</tr>
<?php do { ?>
<tr>
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rsGetUser){
?>
<th scope="row"><?php
if(TRUE){ // Begin Cached Resized Image: ImageCacheInstance_1433274395061
ob_start();
?>
<img name="ShowThumbnail" src="<?php echo $row_rsGetUser['PicImageFolder']; ?><?php echo $row_rsGetUser['PicImageName']; ?>" width="180" height="100" alt="">
<?php
echo(getCachedResizedImageHTML(ob_get_clean(), "../image_cache", "crop", "", false));
} // End Cached Resized Image: ImageCacheInstance_1433274395061
?></th>
<td>Name</td>
<td><input type="hidden" name="WADA_RepeatID_PicID_<?php echo $RepeatSelectionCounter_1; ?>" id="WADA_RepeatID_PicID_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rsGetUser["PicID"]; ?>" />
<input <?php if (!(strcmp($row_rsGetUser['PicImageActive'],1))) {echo "checked=\"checked\"";} ?> name="UsrImgActive_<?php echo $RepeatSelectionCounter_1; ?>" type="checkbox" id="checkbox_<?php echo $RepeatSelectionCounter_1; ?>" value="1" ></td>
<td>Amend</td>
<td>Delete</td>
<td><input <?php if (!(strcmp($row_rsGetUser['PicImageMain'],"1"))) {echo "checked=\"checked\"";} ?> name="UsrImgPrime_<?php echo $RepeatSelectionCounter_1; ?>" type="radio" id="UsrImgPrime_<?php echo $RepeatSelectionCounter_1; ?>" value="1">
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<td>No records match your request.</td>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_rsGetUser && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rsGetUser = mysql_fetch_assoc($rsGetUser);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
</tr>
<?php } while ($row_rsGetUser = mysql_fetch_assoc($rsGetUser)); ?>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<input name="BtnPrimeImg" type="submit" value="Update">
<input name="UsrImgPrimeDate" type="hidden">

A normal radio group share the same input name so only one can be selected, if i do the same here it behaves as a group but changes are not saved and returned when the page is refreshed.


Update: so i found this; http://www.webassist.com/forums/posts.php?id=31138

Resolved:
I've settled for using a second record update behaviour to post the selected value in. I can then call it through a recordset.
I seemed to have simplified the problem and solution!

Just need to tweak the following to return the selected option button when page is refreshed - it currently returns nothing!

<input <?php if (!(strcmp($row_rsGetUser['PicImagePrime'],1))) {echo "checked=\"checked\"";} ?> type="radio" id="UsrImgPrime_<?php echo $row_rsGetUser['PicID']; ?>" name="UsrImgPrime" value="<?php echo $row_rsGetUser['PicID']; ?>">


Any ideas anyone?

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