custom lookup filter

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mpol_ch
User
Posts: 877
Location: Switzerland

custom lookup filter

Post by mpol_ch »

Hello
I am using the following two tables: elist and users. The users can subscribe many lists (newsletters). Now, I want that the users emails is listed in lookup filter if user is not, for the selected newsletter, in the table elist.

elist: list_id,list_email
users: users_email

list_id is a Drop_Down and content like 1,2,5 etc
list_email: Lookup Drop_Down table on users_email

How can I solve this with PHPMAKER10?

Thanks
mpol_ch


Webmaster
User
Posts: 9430

Post by Webmaster »

list_id is selected on the client side so you need to use Ajax. There is no built-in feature in PHPMaker for this, you need to write your code. The approach should be like: (v10)

  1. Enable "Use Ajax" for the list_email field,
  2. Use Lookup_Selecting server event (see Server Events and Client Scripts in the help file) to add your additional filter, e.g.

ew_AddFilter($filter, "Your Filter with {query_value_1}"); // Your filter should be able to return the records you want based on the selected list_id (represented by "{query_value_1}" in the filter)

  1. Add jQuery ajaxSend event (see http://api.jquery.com/ajaxSend/) for the list_email selection to add the selected list_id to the data to be sent to server side, e.g.

$(document).ajaxSend(function(event, jqxhr, settings) {
if (...your condition...) settings.data += "&q1=" + $("#x_list_id").val(); // Assume NOT Grid-Add/Edit
});

q<n> in Ajax data will replace '{query_value_<n>}' in your filter, e.g. q1 will replace '{query_value_1}'.


Post Reply