Pauldro Posted July 7, 2016 Share Posted July 7, 2016 I'm looking to do a specific type of module. I want to use the field-typemulti fieldtype. So what I want to accomplish is the first field part stores a category (movies, books, etc.). The Second input field would need to be an AJAX lookup that would let me choose the ID of that book so I can take it and save it into my post. So let's just say the thing I'm pulling from is IMDB, I'll choose the movie category, then On the lookup get a list of movies based on a search. IF you can point me and help me out with this i'd greatly appreciate it! Link to comment Share on other sites More sharing options...
Martijn Geerts Posted July 7, 2016 Share Posted July 7, 2016 I would say a ProcessModule for the AJAX request. That module should extend Process and Make sure the config array contains 'permission' => 'page-edit' 1 Link to comment Share on other sites More sharing options...
Soma Posted July 7, 2016 Share Posted July 7, 2016 No need for a extra Process page. Just send a ajax POST/GET request with a special key you recognize in your module's init(), do the work and send back an result. 3 Link to comment Share on other sites More sharing options...
kongondo Posted July 18, 2016 Share Posted July 18, 2016 On 07/07/2016 at 5:09 PM, Soma said: No need for a extra Process page. Just send a ajax POST/GET request with a special key you recognize in your module's init(), do the work and send back an result. Hi @Soma. Could you please elaborate on how to do this? I don't quite follow what is being sent where . Thanks.. Link to comment Share on other sites More sharing options...
Soma Posted July 20, 2016 Share Posted July 20, 2016 Something along the way public function init(){ if($this->config->ajax && $this->input->InputfieldMyAjaxBomb){ // handle your ajax request header('Content-Type: application/json'); echo "{'yo':'yo'}"; exit; } } .. in your Inputfield init(). Then you can make a post or get AJAX request to any backend or public url the current url containing the key InputfieldMyAjaxBomb=1. Edit: Originally I didn't really mean that there's "no need". Well, of course a hidden admin ProcessPage bundled with your module is also good and honestly maybe even the more correct way. But It's easy to implement and test things out too. 1 Link to comment Share on other sites More sharing options...
kongondo Posted July 20, 2016 Share Posted July 20, 2016 Thanks Soma. I have been doing it the 'hidden-admin-page-way'...as you suggested way back in this thread . Good to know there's other ways too. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now