Forums
This topic is locked
INSERT multiple records with repeat region
Posted 15 Jan 2005 02:44:42
1
has voted
15 Jan 2005 02:44:42 Paul McGarry posted:
I'm new to this so please be gentle:I have an asp:javascript page which queries a database (access) for members and their guests registered for a tournament (from a table called Registrations). This is done as a repeat region (Dreamweaver Server Behaviour). Once populated, the person viewing the page can enter in which flight and pairing the member/guests are in. I then added an INSERT record behaviour (again Dreamweaver pre-built) to presumedly insert a distinct record for each item on my page into a second table called Pairings. I have added a single button at the bottom of the page to post the information. Easy peasy me thinks. But no. When I actually run this page it will insert only a single record.
I have searched the forums high and low and perhaps i have not entered the right search criteria or just don't get it when i read the results (a distinct possibility). But my question is: can I with a single submit button create separate records in my table Pairings? I have pasted my form code below. In the interest of space I have omitted the server code which is all generic Macromedia code for creating recordsets and insert server behaviours etc.
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="frm_createpairing">
<% while ((Repeat1__numRows-- != 0) && (!rsRegistrants.EOF)) { %>
<%
var fname=(rsRegistrants.Fields.Item("Firstname".Value)
var lname=(rsRegistrants.Fields.Item("Lastname".Value)
var name = fname + " " + lname;
%>
<input name="txt_membername" value="<%=name%>" readonly>
<input name="txt_mbrhandicap" value="<%=(rsRegistrants.Fields.Item("Username_Handicap".Value)%>" size="3" readonly>
<select name="lst_mbrflight" size="1">
<option value="A">A</option>
<option value="B">B</option>
</select>
<select name="lst_mbrpairing" size="1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
<%
//check to see if member has registered guest1
var guest1 = rsRegistrants("Guest1".Value;
if ( guest1 != null && guest1 != "" )
{
// *end* the ASP code to insert HTML:
%>
<input name="txt_Guest1" value="<%=(guest1)%>" readonly>
<input name="txt_Guest1_Handicap" value="<%=(rsRegistrants("Guest1_Handicap".Value)%>" size="2" readonly>
<input name="txt_guest1flight" value="A" type="text" size="1" readonly>
<%
}
else
{
%>
<br>
<%
}
%>
<%
//check to see if member has registered guest2
var guest2 = rsRegistrants("Guest2".Value;
if ( guest2 != null && guest2 != "" )
{
// *end* the ASP code to insert HTML:
%>
<input name="txt_Guest2" value="<%=(guest2)%>" readonly>
<input name="txt_Guest2_Handicap" value="<%=(rsRegistrants("Guest2_Handicap".Value)%>" size="2" readonly>
<input name="txt_guest2flight" value="A" type="text" size="1" readonly>
<%
}
%>
<%
//check to see if member has registered guest3
var guest3 = rsRegistrants("Guest3".Value;
if ( guest3 != null && guest3 != "" )
{
// *end* the ASP code to insert HTML:
%>
<input name="txt_Guest3" value="<%=(guest3)%>" readonly>
<input name="txt_Guest3_Handicap" value="<%=(rsRegistrants("Guest3_Handicap".Value)%>" size="2" readonly>
<input name="txt_guest3flight" value="A" type="text" size="1" readonly>
<%
}
%>
<%
Repeat1__index++;
rsRegistrants.MoveNext();
}
%>
<br>
<br>
<div align="left"><input name="btn_create" type="submit" value="Create"></div>
<input type="hidden" name="MM_insert" value="frm_createpairing">
</form>
Replies
Replied 21 Jan 2005 10:42:45
21 Jan 2005 10:42:45 Vince Baker replied:
Hi,
You may well need to pass the details to a script page to process this. You can hard code an insert sql statement on the page...
Do you have a repeat region on the page with the recordset containing the records you need to insert?
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
(Now completely CSS based and bye bye to all tables!)
VBScript | ASP | HTML | CSS | SQL | Oracle | Hosting
Edited by - bakerv on 21 Jan 2005 10:45:19
You may well need to pass the details to a script page to process this. You can hard code an insert sql statement on the page...
Do you have a repeat region on the page with the recordset containing the records you need to insert?
Regards
Vince
DMX Talkzone Manager
Visit my home: www.chez-vince.com
(Now completely CSS based and bye bye to all tables!)
VBScript | ASP | HTML | CSS | SQL | Oracle | Hosting
Edited by - bakerv on 21 Jan 2005 10:45:19