Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Submitting multiple record IDs via a form.

Reply
Thread Tools

Submitting multiple record IDs via a form.

 
 
CJM
Guest
Posts: n/a
 
      10-23-2003
I have a problem more to do with style than ability; I can solve this
problem in a number of ways, but I'm keen to find the best way of doing
this...

We have a facility on our intranet where users can log problems, comments &
suggestions about the site to a DB.
I'm building a page that lists the outstanding entries, and allows use to
mark any number of entries as being 'done'

That is, we have a number of rows, with the last field in each row being a
checkbox to indicate the entry has been dealt with. At the end, there is an
Update button which submits the form.

The question is.. how to handle this...?

The best solution I have thought of so far is to use the record ID as the ID
for each checkbox. Then to Split() the resulting Request.Form into an array,
loop through the array picking out the record IDs.

It's not a bad solution, but I figured this must be a fairly common
procedure and that somebody might have a slicker way of doing it...

Any ideas?

Chris




 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      10-23-2003
Name all the checkboxes the same, and use the ID number for the values, as
so:


<input name="chkID" value="1">
<input name="chkID" value="5">
<input name="chkID" value="13">
<input name="chkID" value="19">


Then on the page that processes, update them all with one SQL statement.

sToUpdate = Request.Form("chkID")
''will return a string like 1, 5, 13, 19


If Len(sToUpdate) > 0 Then
sSQL = "UPDATE TheTable SET TheColumn=TheValue WHERE [ID] IN (" &
sToUpdate & ")"
''create connection here
YourADOConnection.Execute sSQL
End If

Ray at work

"CJM" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a problem more to do with style than ability; I can solve this
> problem in a number of ways, but I'm keen to find the best way of doing
> this...
>
> We have a facility on our intranet where users can log problems, comments

&
> suggestions about the site to a DB.
> I'm building a page that lists the outstanding entries, and allows use to
> mark any number of entries as being 'done'
>
> That is, we have a number of rows, with the last field in each row being a
> checkbox to indicate the entry has been dealt with. At the end, there is

an
> Update button which submits the form.
>
> The question is.. how to handle this...?
>
> The best solution I have thought of so far is to use the record ID as the

ID
> for each checkbox. Then to Split() the resulting Request.Form into an

array,
> loop through the array picking out the record IDs.
>
> It's not a bad solution, but I figured this must be a fairly common
> procedure and that somebody might have a slicker way of doing it...
>
> Any ideas?
>
> Chris
>
>
>
>



 
Reply With Quote
 
 
 
 
Tom B
Guest
Posts: n/a
 
      10-23-2003
Don't forget to update the values that were unchecked. That is, if a
checkbox had been checked, and then it was unchecked, it would not be
reflected in Ray's solution.



"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:(E-Mail Removed)...
> Name all the checkboxes the same, and use the ID number for the values, as
> so:
>
>
> <input name="chkID" value="1">
> <input name="chkID" value="5">
> <input name="chkID" value="13">
> <input name="chkID" value="19">
>
>
> Then on the page that processes, update them all with one SQL statement.
>
> sToUpdate = Request.Form("chkID")
> ''will return a string like 1, 5, 13, 19
>
>
> If Len(sToUpdate) > 0 Then
> sSQL = "UPDATE TheTable SET TheColumn=TheValue WHERE [ID] IN (" &
> sToUpdate & ")"
> ''create connection here
> YourADOConnection.Execute sSQL
> End If
>
> Ray at work
>
> "CJM" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I have a problem more to do with style than ability; I can solve this
> > problem in a number of ways, but I'm keen to find the best way of doing
> > this...
> >
> > We have a facility on our intranet where users can log problems,

comments
> &
> > suggestions about the site to a DB.
> > I'm building a page that lists the outstanding entries, and allows use

to
> > mark any number of entries as being 'done'
> >
> > That is, we have a number of rows, with the last field in each row being

a
> > checkbox to indicate the entry has been dealt with. At the end, there is

> an
> > Update button which submits the form.
> >
> > The question is.. how to handle this...?
> >
> > The best solution I have thought of so far is to use the record ID as

the
> ID
> > for each checkbox. Then to Split() the resulting Request.Form into an

> array,
> > loop through the array picking out the record IDs.
> >
> > It's not a bad solution, but I figured this must be a fairly common
> > procedure and that somebody might have a slicker way of doing it...
> >
> > Any ideas?
> >
> > Chris
> >
> >
> >
> >

>
>



 
Reply With Quote
 
CJM
Guest
Posts: n/a
 
      10-23-2003
Fair point, but in this instance once an entry has been marked as 'done' is
disappears... there is no unchecking capability.

Thanks

"Tom B" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Don't forget to update the values that were unchecked. That is, if a
> checkbox had been checked, and then it was unchecked, it would not be
> reflected in Ray's solution.
>
>
>
> "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
> news:(E-Mail Removed)...
> > Name all the checkboxes the same, and use the ID number for the values,

as
> > so:
> >
> >
> > <input name="chkID" value="1">
> > <input name="chkID" value="5">
> > <input name="chkID" value="13">
> > <input name="chkID" value="19">
> >
> >
> > Then on the page that processes, update them all with one SQL statement.
> >
> > sToUpdate = Request.Form("chkID")
> > ''will return a string like 1, 5, 13, 19
> >
> >
> > If Len(sToUpdate) > 0 Then
> > sSQL = "UPDATE TheTable SET TheColumn=TheValue WHERE [ID] IN (" &
> > sToUpdate & ")"
> > ''create connection here
> > YourADOConnection.Execute sSQL
> > End If
> >
> > Ray at work
> >
> > "CJM" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I have a problem more to do with style than ability; I can solve this
> > > problem in a number of ways, but I'm keen to find the best way of

doing
> > > this...
> > >
> > > We have a facility on our intranet where users can log problems,

> comments
> > &
> > > suggestions about the site to a DB.
> > > I'm building a page that lists the outstanding entries, and allows use

> to
> > > mark any number of entries as being 'done'
> > >
> > > That is, we have a number of rows, with the last field in each row

being
> a
> > > checkbox to indicate the entry has been dealt with. At the end, there

is
> > an
> > > Update button which submits the form.
> > >
> > > The question is.. how to handle this...?
> > >
> > > The best solution I have thought of so far is to use the record ID as

> the
> > ID
> > > for each checkbox. Then to Split() the resulting Request.Form into an

> > array,
> > > loop through the array picking out the record IDs.
> > >
> > > It's not a bad solution, but I figured this must be a fairly common
> > > procedure and that somebody might have a slicker way of doing it...
> > >
> > > Any ideas?
> > >
> > > Chris
> > >
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
CJM
Guest
Posts: n/a
 
      10-23-2003
That's exactly what I was looking for.

Glad I asked now..

tx

Chris

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:(E-Mail Removed)...
> Name all the checkboxes the same, and use the ID number for the values, as
> so:
>
>
> <input name="chkID" value="1">
> <input name="chkID" value="5">
> <input name="chkID" value="13">
> <input name="chkID" value="19">
>
>
> Then on the page that processes, update them all with one SQL statement.
>
> sToUpdate = Request.Form("chkID")
> ''will return a string like 1, 5, 13, 19
>
>
> If Len(sToUpdate) > 0 Then
> sSQL = "UPDATE TheTable SET TheColumn=TheValue WHERE [ID] IN (" &
> sToUpdate & ")"
> ''create connection here
> YourADOConnection.Execute sSQL
> End If
>
> Ray at work
>
> "CJM" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I have a problem more to do with style than ability; I can solve this
> > problem in a number of ways, but I'm keen to find the best way of doing
> > this...
> >
> > We have a facility on our intranet where users can log problems,

comments
> &
> > suggestions about the site to a DB.
> > I'm building a page that lists the outstanding entries, and allows use

to
> > mark any number of entries as being 'done'
> >
> > That is, we have a number of rows, with the last field in each row being

a
> > checkbox to indicate the entry has been dealt with. At the end, there is

> an
> > Update button which submits the form.
> >
> > The question is.. how to handle this...?
> >
> > The best solution I have thought of so far is to use the record ID as

the
> ID
> > for each checkbox. Then to Split() the resulting Request.Form into an

> array,
> > loop through the array picking out the record IDs.
> >
> > It's not a bad solution, but I figured this must be a fairly common
> > procedure and that somebody might have a slicker way of doing it...
> >
> > Any ideas?
> >
> > Chris
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting IDs back when submitting Josh Valino ASP .Net 3 02-11-2008 04:53 PM
after transfer of data from MS-outlook(mail ids) to application,mail ids are consisting of strange characters vamsikrishna_b@coolgoose.com Python 2 06-21-2005 12:41 PM
Disable Validation when submitting via JScript? Jo Inferis ASP .Net 7 05-25-2005 08:11 PM
Problem submitting form via JS Richard Dixson Javascript 1 12-13-2004 03:34 PM
submitting a page via a servlet? Flip Java 5 05-17-2004 02:33 PM



Advertisments