close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help with multiple insert

Thread began 4/28/2015 10:20 am by iain331081 | Last modified 4/30/2015 3:41 pm by Ray Borduin | 2979 views | 10 replies |

iain331081

Help with multiple insert

I am just trying to add a multiple record insert on a page, but have run into a problem as the Insert Multiple Records behaviour is showing **No Tables Listed**, even though it is a page which is already pulling through records from a table.

If someone could have a look and get me back on track that would be appreciated.

Its hopefully almost there - if you tick some boxes, it added the last one you tick (if you are working down), so its just missing the looping required to adde them all.

In a related note, it was set to show 30 records per page, but I assume for this it needs to show all records. But when I went to change that in the server behaviours for the repeat region WADAlodges I get an error saying the recordset cannot be found, even though it is there and seems to be working correctly. So I have changed the number of records to 1000 in the meantime.

I have attached the page and posted more details below.

Thanks.

Sign in to reply to this post

iain331081

Details below.

Sign in to reply to this post

Ray BorduinWebAssist

I'm afraid this is a little too complex for me to work out through this forum. Fixing your page and getting it working would be more appropriate for a premier support ticket.

No tables listed is usually a problem with your site definition. You might try toggling your connection in the interface to force it to refresh... or check to see if the tables show properly when creating a recordset.

If the tables do show in a recordset ui but not in the multiple insert, then that is something I can debug with you because it would be a bug in that interface of some sort. If that is the case, then please post a US phone number or Skype contact information in a reply and I'll schedule a phone call to debug why that is happening.

Sign in to reply to this post
Did this help? Tips are appreciated...

iain331081

OK, thanks Ray. I tried taking the WADAlodges recordset code out, and creating the recordset again, but the recordset still doesn't show up in the server behaviours panel.

Sign in to reply to this post

iain331081

I'll have a look at stripping out all the PHP elements from the page and adding it in again to see if I can spot the culprit.

Sign in to reply to this post

iain331081

EDIT - Just to say I have this example working as expected now. So going to try and use the code in the original example and see how I go...


Hi Ray - I think the no tables issue is to do with my server settings / path, but I couldn't get it to work. In the end I looked at testing it on another project where I don't seem to have that issue.

I got as far as creating a test page, and applied the Insert Multiple records behaviour - but it doesn't see to be working.

When both tick boxes are ticked, it currently inserts two records, but both for Charney Manor, rather one for each venue listed, so doesn't seem to be looping correctly.

I have attached the file below.

If you could have a look and see if its anything obvious on this one that would be a great help.

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

It looks like it would work to me... If you send me FTP information I will debug it.

Sign in to reply to this post
Did this help? Tips are appreciated...

iain331081

Thanks Ray.

I realised it wasn't looping the venue and town values, so I added:

<input name="Venue_<?php echo $RepeatSelectionCounter_1; ?>" id="Venue_<?php echo $RepeatSelectionCounter_1; ?>"  type="hidden" value="<?php echo($row_Recordset1["Venue"]); ?>" tabindex="3" title="Venue">
<input name="Town_<?php echo $RepeatSelectionCounter_1; ?>" id="Town_<?php echo $RepeatSelectionCounter_1; ?>" type="hidden" value="<?php echo($row_Recordset1["Venue"]); ?>" tabindex="4" title="Town">



And that fixed it.

I'll see if I can get it to work in the original example, but will come back to you if I get stuck with it.

Sign in to reply to this post

iain331081

EDIT - I think this is working now - had missed a couple of field name references that needed changing.

One question though - what code would I need to get it to select all, or clear all?

I thought from somewhere it may just be:

<input type="button" name="check" value="Select All Contacts" id="check" onClick="check_all(boxes, check_box);" />
<input type="button" name="uncheck" value="Clear All Checkboxes" id="uncheck" onClick="uncheck_all(boxes, check_box);" />



But that doesn't seem to be working.

EDIT: I looked it up and realised there are a couple of bits of Javascript needed too:

<script type="text/javascript">
var check_box = new Array();
var boxes = 0;
</script>



in the header, and:

<script type="text/javascript">
check_box[boxes] = "LodgeIDPL_<?php echo $RepeatSelectionCounter_1; ?>";
boxes += 1;
</script>



in the form.

Although that still isn't working.

Attached Files
index501.zip
Sign in to reply to this post

iain331081

have been trying to find a solution to this - the closest I got was the JS:

<script type="text/javascript">
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
if(!document.forms[FormName])
return;
var objCheckBoxes = document.forms[FormName].elements[FieldName];
if(!objCheckBoxes)
return;
var countCheckBoxes = objCheckBoxes.length;
if(!countCheckBoxes)
objCheckBoxes.checked = CheckValue;
else
// set the check value for all check boxes
for(var i = 0; i < countCheckBoxes; i++)
objCheckBoxes[i].checked = CheckValue;
}
</script>



Which worked if the name of the checkbox was a constant, e.g.:

<input name="LodgeIDPL" id="LodgeIDPL_<?php echo $RepeatSelectionCounter_1; ?>" type="checkbox" value="<?php echo($row_WADAlodges['LodgeID']); ?>" />



Using:

<input type="button" onclick="SetAllCheckBoxes('Insert_Basic_Default', 'LodgeIDPL', true);" value="Select All Products">&nbsp;&nbsp;
<input type="button" onclick="SetAllCheckBoxes('Insert_Basic_Default', 'LodgeIDPL', false);" value="Deselect All Products">



But it doesn't work here because of the RepeatSelectionCounter being part of the name:

<input name="LodgeIDPL_<?php echo $RepeatSelectionCounter_1; ?>" id="LodgeIDPL_<?php echo $RepeatSelectionCounter_1; ?>" type="checkbox" value="<?php echo($row_WADAlodges['LodgeID']); ?>" />



If you knew of a way to get this to work that would a great help.

Sign in to reply to this post
loading

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