Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Insert Multiple Records-Using repeat region (VBS)

Posted 03 Mar 2005 00:04:42
1
has voted
03 Mar 2005 00:04:42 mark smith posted:
I have a page displaying records using a repeat region from tableA. Each repeat region includes two checkboxes and a list box.

I need to insert into tableB a new record with the unique key from each record in TableA and the input from the form components.

I assume I need to assign a unique name to each form component, but need some guidance on this.

TIA.

Mark

Replies

Replied 03 Mar 2005 10:53:49
03 Mar 2005 10:53:49 Vince Baker replied:
Hi mark,

You have two options on how to handle this, the first is as you say to give each element a unique name, the easiest way to do this is to add the id to the name of the form element and then when you move to your processing page just strip it off of the name and voila...

You could also do this another way:

apply an onclick function to an image inside the repeat region and place the value of your checkbox etc inside the parenthesis and pass that to the head of your document to navigate to your processing page sending the values:

e.g.

onClick("processForm('document.yourform.fieldname1.value',document.yourform.fieldname2.value')

and then in the head:


<script language="VBScript">

sub processForm(var1, var2)

window.navigate("your_processing_page.asp?var1=" & var1 & "&var2=" & var2)

end sub

</script>

Regards

Vince Baker
<strong>DMX Zone Manager</strong>

[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Replied 03 Mar 2005 18:08:17
03 Mar 2005 18:08:17 Wim Conix replied:
Mark,

Perfect what Vince give you as solution...
In the processing page it is very easy to use Commands (Insert) for each record you want to add.
Make sure you use GET in the checkbox-page. That way you send the parameters to the processing page.
There you can pick them up with SQL-statement WHERE IN...

If you send me your emailadress, I can send you the files I made as an example.

Greetings,

Wim

Edited by - dannybrison on 03 Mar 2005 18:13:20
Replied 04 Mar 2005 01:36:41
04 Mar 2005 01:36:41 mark smith replied:
Thanks for the replies. I have created my form page with uniqueID's for each form object by assigning a recordID variable to each form object name, but I am having trouble creating the loop that will insert the records into my table.

can anyone give me a rough example of how the looop should be structured ?

Thanks again.



Edited by - mrkiplin on 04 Mar 2005 01:37:25

Reply to this topic