HighDots Forums  

Filter recordset on form field

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Filter recordset on form field in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Matt Houldworth
 
Posts: n/a

Default Filter recordset on form field - 07-19-2004 , 08:28 AM






Hi all

I have a form field that contains id numbers out of database - format
1,2,6,8 etc depending on what user chooses

I want to filter a recordsets id based on that form field to show only the
field id's in the form field and then do a repeat region to show the
recordset

I have the field working, and have a recordset setup filtering as follows

SELECT *
FROM propertytype
WHERE id = MMColParam

where MMColParam is Request.Form("id") where id is the name of the field

this seems to work in Dreamweaver however the repeat region only shows the
first record in the asp page

any ideas anone?

Thanks for help in advance

Matt Houldsworth
Digitalquill



Reply With Quote
  #2  
Old   
Les Matthews
 
Posts: n/a

Default Re: Filter recordset on form field - 07-19-2004 , 10:34 AM






If you are going to use Request.Form, then the form must be submitted - else
the variable does not exist. Maybe I don't understand your question, but why
would you want to display filtered results before the user has made a filter
selection - i.e. 1, 2, 6, 8, etc.?

Also you should not use a possible real value as your default value. You
should change
housetype__MMColParam = "1"
to
housetype__MMColParam = "0"


"Matt Houldworth" <matthew@-NOSPAM-digitalquill.co.uk> wrote

Quote:
I have it working using the IN command

so i now have it so that it filters off form field (see below)

but...

you have to press return key in the form field for it to filter, how can i
make this filter onLoad based on the form field as i want this hidden

Matt Houldsworth
Digitalquill



%
Dim housetype__MMColParam
housetype__MMColParam = "1"
If (Request.Form("houseid") <> "") Then
housetype__MMColParam = Request.Form("houseid")
End If
%
%
Dim housetype
Dim housetype_numRows

Set housetype = Server.CreateObject("ADODB.Recordset")
housetype.ActiveConnection = MM_vbhousetypes_STRING
housetype.Source = "SELECT housetype, id, urlvalue FROM propertytype
WHERE
id IN (" + Replace(housetype__MMColParam, "'", "''") + ")"
housetype.CursorType = 0
housetype.CursorLocation = 2
housetype.LockType = 1
housetype.Open()

housetype_numRows = 0
%




"Matt Houldworth" <matthew@-NOSPAM-digitalquill.co.uk> wrote in message
news:cdgdth$8sc$1 (AT) forums (DOT) macromedia.com...
Hi all

I have a form field that contains id numbers out of database - format
1,2,6,8 etc depending on what user chooses

I want to filter a recordsets id based on that form field to show only
the
field id's in the form field and then do a repeat region to show the
recordset

I have the field working, and have a recordset setup filtering as
follows

SELECT *
FROM propertytype
WHERE id = MMColParam

where MMColParam is Request.Form("id") where id is the name of the field

this seems to work in Dreamweaver however the repeat region only shows
the
first record in the asp page

any ideas anone?

Thanks for help in advance

Matt Houldsworth
Digitalquill







Reply With Quote
  #3  
Old   
Matt Houldworth
 
Posts: n/a

Default Re: Filter recordset on form field - 07-19-2004 , 10:38 AM



I have it working using the IN command

so i now have it so that it filters off form field (see below)

but...

you have to press return key in the form field for it to filter, how can i
make this filter onLoad based on the form field as i want this hidden

Matt Houldsworth
Digitalquill



<%
Dim housetype__MMColParam
housetype__MMColParam = "1"
If (Request.Form("houseid") <> "") Then
housetype__MMColParam = Request.Form("houseid")
End If
%>
<%
Dim housetype
Dim housetype_numRows

Set housetype = Server.CreateObject("ADODB.Recordset")
housetype.ActiveConnection = MM_vbhousetypes_STRING
housetype.Source = "SELECT housetype, id, urlvalue FROM propertytype WHERE
id IN (" + Replace(housetype__MMColParam, "'", "''") + ")"
housetype.CursorType = 0
housetype.CursorLocation = 2
housetype.LockType = 1
housetype.Open()

housetype_numRows = 0
%>




"Matt Houldworth" <matthew@-NOSPAM-digitalquill.co.uk> wrote

Quote:
Hi all

I have a form field that contains id numbers out of database - format
1,2,6,8 etc depending on what user chooses

I want to filter a recordsets id based on that form field to show only the
field id's in the form field and then do a repeat region to show the
recordset

I have the field working, and have a recordset setup filtering as follows

SELECT *
FROM propertytype
WHERE id = MMColParam

where MMColParam is Request.Form("id") where id is the name of the field

this seems to work in Dreamweaver however the repeat region only shows the
first record in the asp page

any ideas anone?

Thanks for help in advance

Matt Houldsworth
Digitalquill





Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.