Macrura Posted July 28, 2017 Share Posted July 28, 2017 i have one type of button that submits via ajax so does all of the processing without opening a new window; some of my more primitive versions just open a new window to run the action... 1 Link to comment Share on other sites More sharing options...
bernhard Posted July 28, 2017 Share Posted July 28, 2017 yeah, i also went with ajax for now. but it's strange that it worked before... and it seems more complicated now than necessary and with pw that's usually the feeling when something is wrong Link to comment Share on other sites More sharing options...
kongondo Posted July 28, 2017 Author Share Posted July 28, 2017 1 hour ago, bernhard said: so what changed since your example here? and how could i detect clicks on buttons? Nothing has changed. It works just fine. If you use $input->post in your 'my-file.php', it will work as expected. If used directly in 'Copy Paste' code, it won't. 1 hour ago, bernhard said: and how could i detect clicks on buttons? For buttons, that would have to be JS from what I see. E.g., dump this after if($copy) {} in my example in the quoted post: echo '<pre>'; print_r($input->post); echo '</pre>'; exit; You will see all the POST values (but no 'submit_save' there; I guess the post is submitted in some other way) including the 'Create Copy' button, body fields, etc. So, to detect submit button, you could do the following in your 'my-file.php': if($input->post->title) { // blah blah } Link to comment Share on other sites More sharing options...
Noel Boss Posted September 5, 2017 Share Posted September 5, 2017 Hi Kongondo Thanks for this great module! I use it on several templates and in the frontend everything works fine. I use it mainly to concatenate text… Now i have a firstname and lastname field on the user that i combine into a single runtimemarkup field "fullname" – it displays correctly in the frontend but the backend profile page does not display the computed value: return $page->firstname." ".$page->lastname; Any ideas on why that could happen? Link to comment Share on other sites More sharing options...
Macrura Posted September 5, 2017 Share Posted September 5, 2017 @noelboss - have you tried using TracyDebugger yet? You could get that going and then troubleshoot the contents of the $page in the profile editor; you may also be able to see warnings and errors when using Tracy. Using it is pretty much required if you are doing any serious dev work in the backend. 3 Link to comment Share on other sites More sharing options...
kongondo Posted September 5, 2017 Author Share Posted September 5, 2017 7 hours ago, noelboss said: Hi Kongondo Thanks for this great module! I use it on several templates and in the frontend everything works fine. I use it mainly to concatenate text… Now i have a firstname and lastname field on the user that i combine into a single runtimemarkup field "fullname" – it displays correctly in the frontend but the backend profile page does not display the computed value: return $page->firstname." ".$page->lastname; Any ideas on why that could happen? Welcome to the forums. Glad you find the module useful. Regarding your question, it's hard to tell without seeing some code. Are you using the field directly in the ProcessWire user template or you have some other pseudo page for users? Link to comment Share on other sites More sharing options...
Robin S Posted September 14, 2017 Share Posted September 14, 2017 On 06/09/2017 at 4:57 AM, kongondo said: Are you using the field directly in the ProcessWire user template or you have some other pseudo page for users? I'm guessing he is talking about the profile edit interface (ProcessProfile). There are a couple of places where the module assumes/requires ProcessPageEdit. Link to comment Share on other sites More sharing options...
kongondo Posted November 21, 2017 Author Share Posted November 21, 2017 Hi all. I am intending to ONLY support ProcessWire 3.x starting from the next version of this module. Please have a read here and let me know what you think. Thanks. Link to comment Share on other sites More sharing options...
Macrura Posted December 1, 2017 Share Posted December 1, 2017 Is it possible to use field collapsed status with this - since the module itself doesn't have a value that can trigger 'populated' status (?)... I'm using a lot of these on a page , but need keep them all open... Link to comment Share on other sites More sharing options...
kongondo Posted December 3, 2017 Author Share Posted December 3, 2017 On 01/12/2017 at 3:35 PM, Macrura said: but need keep them all open... Aren't they all staying open? On 01/12/2017 at 3:35 PM, Macrura said: Is it possible to use field collapsed status Will investigate. Link to comment Share on other sites More sharing options...
Macrura Posted December 3, 2017 Share Posted December 3, 2017 oops, mis-typed, i meant keep closed when blank; they do stay open if set to open. I guess maybe i need to make sure my code returns empty for this to work; will check again. Link to comment Share on other sites More sharing options...
dragan Posted December 30, 2017 Share Posted December 30, 2017 Can't believe I discovered this awesome module only recently... I mean, it's over 2 years old now already Here's another use-case: 3 Link to comment Share on other sites More sharing options...
hezmann Posted February 16, 2018 Share Posted February 16, 2018 I'm getting a strange glitch with this. I'm on PW 3.0.9. If I put my code directly into the field it works fine, but if I try to use an external file using return ProcessWire\wireRenderFile('runtime.php'); the page is always returned as page id 10, not the the page I'm on. Not tragic as I can put the code directly in the field but would be better to have it external if possible. Thanks! Heather Link to comment Share on other sites More sharing options...
kongondo Posted February 16, 2018 Author Share Posted February 16, 2018 (edited) Hi @hezmann 33 minutes ago, hezmann said: I'm getting a strange glitch with this. I'm on PW 3.0.9. If I put my code directly into the field it works fine, but if I try to use an external file using return ProcessWire\wireRenderFile('runtime.php'); the page is always returned as page id 10, not the the page I'm on. That's because the code (in the field) is locally scoped so that $page refers to the page you are editing. However, if using wireRenderFile(), you need to get the page being edited yourself. When editing a page, the page (named) edit is what ProcessWire assigns to $page. The page edit has the id 10. So, what you need is code like below to get the page being edited: $currentPage = ''; $process = wire('process'); if($process && $process->className() == 'ProcessPageEdit') $currentPage = $process->getPage(); if(!$currentPage) return; // if you get here $currentPage is the page being edited More in this post. Sorry, this should be in the docs. I will update the docs at some point (when I get the time). Hope this helps. Edited February 16, 2018 by kongondo 1 Link to comment Share on other sites More sharing options...
hezmann Posted February 18, 2018 Share Posted February 18, 2018 Thanks @kongondo! That worked with one small change. Line 2 needed to be.. $process = $this->wire('process'); Heather Link to comment Share on other sites More sharing options...
Sonia Margollé Posted March 6, 2018 Share Posted March 6, 2018 Is it possible to use this field on a custom user template ? I'm trying but if I just put "return $page->id" in the field I have an error "Undefined variable: page" ... If I try with a external file, I have $page but It's the "users" parent page and not the user I'm editing Link to comment Share on other sites More sharing options...
kongondo Posted March 6, 2018 Author Share Posted March 6, 2018 8 hours ago, Sonia Margollé said: Is it possible to use this field on a custom user template ? I haven't tried, sorry. I'll check when I get a bit of time. I've never used the custom user template feature so will have to do a bit of reading first. Have you tried with wire('page')? This post might also be handy (i.e. establishing process context) Link to comment Share on other sites More sharing options...
adrian Posted March 16, 2018 Share Posted March 16, 2018 Hey @kongondo - would you consider adding this to the module please? $f = $this->modules->isInstalled('InputfieldAceExtended') ? $this->modules->get('InputfieldAceExtended') : $this->modules->get('InputfieldTextarea'); in the ___getConfigInputfields method? Thanks! Link to comment Share on other sites More sharing options...
adrian Posted March 16, 2018 Share Posted March 16, 2018 It would also be good to have: $f->rows = 20; or even make it configurable. One other thing - because InputfieldAceExtended is not in inline mode, you need <?php to force code highlighting, but your module doesn't allow this. Would you mind stripping out any <?php that is added so that this works? This should do it: $str = eval(str_replace('<?php', '', $this->runtimeFields)); $str = eval(str_replace('<?php', '', $field->runtimeFields)); One each for FieldtypeRuntimMarkup and InputfieldRuntimeMarkup. Thanks! Link to comment Share on other sites More sharing options...
bernhard Posted March 16, 2018 Share Posted March 16, 2018 But still I think using your IDE is the best option for larger code snippets... No need for ACE then. I'm still unsing my render replacement hook Link to comment Share on other sites More sharing options...
adrian Posted March 16, 2018 Share Posted March 16, 2018 2 minutes ago, bernhard said: But still I think using your IDE is the best option for larger code snippets... No need for ACE then I still think it's nice to have even for short snippets, but maybe that's just me? If nothing else it lets you actually use the tab key to indent which you can't do in a normal textarea. Link to comment Share on other sites More sharing options...
bernhard Posted March 16, 2018 Share Posted March 16, 2018 Sure it's nice I think this was lost in translation I meant if you are using the IDE you don't need ACE, but of course it's nice to have it in the backend. The Tracy Console is a perfect example. I'm using ACE myself in several projects 1 Link to comment Share on other sites More sharing options...
adrian Posted March 16, 2018 Share Posted March 16, 2018 Sorry @kongondo - me again I am noticing that the renderMarkup() method is called many times on the currently edited page and it's also called on page reference fields on the page being edited. This makes for a lot of calls to this method that don't seem necessary as far as I can tell. Do you think this can be improved? As an example, I put: bd($page->id); at the top of that method and saw this: I am currently editing page 1100, but there are a few page reference fields which are also showing up in that list. Thanks for taking a look! 2 Link to comment Share on other sites More sharing options...
kongondo Posted March 20, 2018 Author Share Posted March 20, 2018 Thanks @adrian. I'll look at these when I upgrade the module to PW3.x-support only. I have no ETA though, I'm afraid. 1 Link to comment Share on other sites More sharing options...
adrian Posted April 20, 2018 Share Posted April 20, 2018 Hey @kongondo - seems like it's all because of the ___wakeupValue and ___sleepValue methods. Is there any reason they can't just return true, rather than returning $this->renderMarkup($page, $field); ? Thanks! 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