{"action":"created","issue":{"url":"https://api.github.com/repos/akeeba/fof/issues/672","repository_url":"https://api.github.com/repos/akeeba/fof","labels_url":"https://api.github.com/repos/akeeba/fof/issues/672/labels{/name}","comments_url":"https://api.github.com/repos/akeeba/fof/issues/672/comments","events_url":"https://api.github.com/repos/akeeba/fof/issues/672/events","html_url":"https://github.com/akeeba/fof/issues/672","id":348592225,"node_id":"MDU6SXNzdWUzNDg1OTIyMjU=","number":672,"title":"Searchable don't work and question on query","user":{"login":"SparrowDevPro","id":41068619,"node_id":"MDQ6VXNlcjQxMDY4NjE5","avatar_url":"https://avatars2.githubusercontent.com/u/41068619?v=4","gravatar_id":"","url":"https://api.github.com/users/SparrowDevPro","html_url":"https://github.com/SparrowDevPro","followers_url":"https://api.github.com/users/SparrowDevPro/followers","following_url":"https://api.github.com/users/SparrowDevPro/following{/other_user}","gists_url":"https://api.github.com/users/SparrowDevPro/gists{/gist_id}","starred_url":"https://api.github.com/users/SparrowDevPro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SparrowDevPro/subscriptions","organizations_url":"https://api.github.com/users/SparrowDevPro/orgs","repos_url":"https://api.github.com/users/SparrowDevPro/repos","events_url":"https://api.github.com/users/SparrowDevPro/events{/privacy}","received_events_url":"https://api.github.com/users/SparrowDevPro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-08T06:30:24Z","updated_at":"2018-08-08T08:46:47Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\nSorry if it is bad english I am french.\r\n1// I am using FoF for a project but I have some issue with the selectable header field type. It is not working for me.\r\nHere is the code :\r\n```\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<form type=\"browse\" show_header=\"1\" show_filters=\"1\" show_pagination=\"1\" norows_placeholder=\"COM_RDV_COMMON_NORECORDS\">\r\n  <headerset>\r\n    <header name=\"rdv_date_id\" type=\"RowSelect\" label=\"ID\" sortable=\"true\" tdwidth=\"20\"/>\r\n\t<header name=\"request_id\" searchfieldname=\"request_id\" type=\"Searchable\" label=\"ID de la request\" tdwidth=\"20\"/>\r\n\t<header name=\"title\"  label=\"COM_RDV_REQUESTS_TITLE_LABEL\" tdwidth=\"20\" />\r\n\t<header name=\"start_time\" type=\"Field\" label=\"DEBUT\" sortable=\"true\" tdwidth=\"100\"/>\r\n\t<header name=\"end_time\" type=\"Field\" label=\"FIN\" sortable=\"true\" tdwidth=\"100\"/>\r\n  </headerset>\r\n  <fieldset name=\"items\">\r\n    <field name=\"rdv_date_id\" type=\"RowSelect\"/>\r\n\t<field name=\"request_id\" />\r\n\t<field name=\"title\" name_from=\"request_id\" type=\"sql\" key_field=\"rdv_request_id\" value_field=\"title\" query=\"SELECT rdv_request_id,title FROM #__rdv_requests\" />\r\n\t<field name=\"start_time\" type=\"Field\"/>\r\n\t<field name=\"end_time\" type=\"Field\"/>\r\n  </fieldset>\r\n</form>\r\n```\r\n\r\n\r\nThe searchable is on this line : `<header name=\"request_id\" searchfieldname=\"request_id\" type=\"Searchable\" label=\"ID de la request\" tdwidth=\"20\"/>`\r\n\r\nBut when i am on the web site view and try to search the field nothing happen. Do u know why ?\r\n\r\n2// I also take this opportunity to ask for your help regarding the sql field. Is there a way to do multiple query ? Like this ==> SELECT abc FROM table2 WHERE def =(SELECT ... FROM table1 WHERE (???) LIMIT 1)\r\nBecause how to specify the (???) in order it correspond to something like `id=( name_from=\"request_id\").`\r\n\r\nSomething like that.\r\n\r\nHope u have understand my 2 questions.\r\n\r\nThanks in advance for ur reply.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/akeeba/fof/issues/comments/411333804","html_url":"https://github.com/akeeba/fof/issues/672#issuecomment-411333804","issue_url":"https://api.github.com/repos/akeeba/fof/issues/672","id":411333804,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTMzMzgwNA==","user":{"login":"nikosdion","id":256041,"node_id":"MDQ6VXNlcjI1NjA0MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/256041?v=4","gravatar_id":"","url":"https://api.github.com/users/nikosdion","html_url":"https://github.com/nikosdion","followers_url":"https://api.github.com/users/nikosdion/followers","following_url":"https://api.github.com/users/nikosdion/following{/other_user}","gists_url":"https://api.github.com/users/nikosdion/gists{/gist_id}","starred_url":"https://api.github.com/users/nikosdion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikosdion/subscriptions","organizations_url":"https://api.github.com/users/nikosdion/orgs","repos_url":"https://api.github.com/users/nikosdion/repos","events_url":"https://api.github.com/users/nikosdion/events{/privacy}","received_events_url":"https://api.github.com/users/nikosdion/received_events","type":"User","site_admin":false},"created_at":"2018-08-08T08:46:47Z","updated_at":"2018-08-08T08:46:47Z","author_association":"MEMBER","body":"The Searchable field only renders a field which submits something in the POST request. Handling it to perform the actual filtering is the job of the Model. Assuming you are using a regular DataModel, without overriding the SQL query it generates, you need to add the Filter behavior to it, e.g. [through fof.xml](\r\nhttps://github.com/akeeba/fof/wiki/The-XML-configuration-file#behaviors). If you are overriding the query you need to check for the existence of a request_id value in the request and filter by it.\r\n\r\nRegarding the SQL field, it does not allow back references to the request data. That would be **VERY INSECURE** since you’d be injecting raw user data into a SQL query. This is exactly how you get hacked! Never trust your user data. In fact, always treat your user data as malicious unless proven innocent.\r\n\r\nWhat you are looking for is probably the [Model field](\r\nhttps://github.com/akeeba/fof/wiki/Model-Field). Please note that you still do not look into the user submitted data but the request_id value of the currently displayed item. While they appear the same to you, the difference is that the request_id value of the currently displayed item is guaranteed to exist, sanitized and of the correct type and by using the Model field this value is properly filtered and sanitized again before being included in a SQL query."}}
{"actor":{"display_login":"nikosdion"}}