Forums: Get a user-input parameter for list Query - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Get a user-input parameter for list Query Rate Topic: -----

#1 User is offline   pwebb 

  • Member
  • PipPip
  • Group: Members
  • Posts: 21
  • Joined: 03-November 09

Posted 09 February 2010 - 10:21 PM

I want to give the user the option to "Include Closed" records on mysearchpage_list
(usually accessed via Default 'QuickJump' menu; no records on first page)

I know how to do this with a 'WhereAdd' in 'BeforeQueryList' - but how do I get the User Input?
(WhereAdd 'closed=0' if "Include Closed" not selected)

I'd like to prompt the user to choose "Include Closed" (Y/N) on the page, or as the page is selected, then the Search to work on this selection.


I thought I could make a 'mysearchpagelistsetting' page/table with one record/field, direct 'QuickJump' to mysearchpagelistsetting_edit, Redirect from there to mysearchpage_list with a Session variable set.

- but I'm sure these is a much BETTER way?

Ideally, I guess I want an "Include Closed" checkbox (default unchecked) in "Search for:" area at top of list page - I guess 'Search' re-queries, so the WhereAdd will be reprocessed?

That would also allow the user to change "Include Closed" choice and re-search on the page



Still on 6.1 - I need to complete this project before moving to 6.2
0

#2 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 8453
  • Joined: 03-February 03

Posted 10 February 2010 - 03:27 AM

You can add a checkbox to the form using Visual Editor in HTML mode:

<input type="checkbox" name="include" value="yes">Include closed?


Then in any event you can access this checkbox value as $_POST["include"] i.e.
if ($_POST["include"]=="yes")
{
...
}

Best regards,
Sergey Kornilov
0

#3 User is offline   pwebb 

  • Member
  • PipPip
  • Group: Members
  • Posts: 21
  • Joined: 03-November 09

Posted 23 February 2010 - 12:28 AM

Thanks - I've now learnt how to add check box (and other types) to my form.

As I'm in ASP not PHP, I think you meant: Request.Form("include")...
rather than: ($_POST["include"]=="yes")...

Now I'm stuck as to how to capture this in events, as it seems to be too transient - ie, it's not available to any events in list pages??

Is there any way to capture it in list page before/when hitting 'search'?
I also would like to get it in advanced search
0

#4 User is offline   pwebb 

  • Member
  • PipPip
  • Group: Members
  • Posts: 21
  • Joined: 03-November 09

Posted 27 February 2010 - 01:10 AM

Looking for some help here guys!
0

#5 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 8453
  • Joined: 03-February 03

Posted 27 February 2010 - 05:18 AM

Request.Form("include") is a proper way access form element named 'include'.

More info:
http://www.aspwebpro...iableswform.asp
Best regards,
Sergey Kornilov
0

#6 User is offline   pwebb 

  • Member
  • PipPip
  • Group: Members
  • Posts: 21
  • Joined: 03-November 09

Posted 27 February 2010 - 05:25 AM

I understood that already - how do I keep this in the search on list form?
0

#7 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 8453
  • Joined: 03-February 03

Posted 27 February 2010 - 05:33 AM

Request.Form("include") will be accessible in all list page events.
Best regards,
Sergey Kornilov
0

#8 User is offline   pwebb 

  • Member
  • PipPip
  • Group: Members
  • Posts: 21
  • Joined: 03-November 09

Posted 07 March 2010 - 09:44 PM

I need to frame this problem more precisely:

I have now learnt how to add checkbox, and read it (Thanks), and that works fine on, as example, an edit page - because I can get the checkbox value in BeforeAdd event.

There seems no suitable event in list page to capture Request.Form("include")

I want to capture this to change the SQL when user hits 'search'


Do I need to use a different method to capture/save the checkbox status so it can be used in the 'search'?
0

#9 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 8453
  • Joined: 03-February 03

Posted 09 March 2010 - 04:16 AM

Request collection is available in all events. If you are not able to access Request.Form("include") variable you probably placing this check box at the wrong place. It needs to be inside the search form.

The best event to adjust SQL query is BeforeSQLQuery.
Best regards,
Sergey Kornilov
0

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users