joeck Posted May 13, 2019 Share Posted May 13, 2019 Hi there, I'm trying to have a PageReference (single) Select field in the registration form and profile page of the user. I'm trying to achieve this with the module LoginRegister: https://modules.processwire.com/modules/login-register/ I simply added the desired field (team) to the user template and then added the field to the field selection in the module configuration. but the select doesn't render properly (see image attached). I'm assuming the reason is because the PageSelect field isn't text-based: Quote You should stick to using simple text-based fields for now. File/image fields, repeaters, rich text editors and combination fields fields are not supported on the front-end at present. I tried to add the InputFieldPage field to the form manually but only got the error that the field needs to be configured. Even with this blog or this one: I wasn't able to get the Select displaying correctly. This is a very strange and new feeling for me: searching a functionality in Processwire for more than a day and not being able to find a very easy and smart solution. Can someone point me into the right direction? Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 13, 2019 Share Posted May 13, 2019 Just installed Login/Register/Profile module, created a page reference field and a select options field to test, added both fields to the user template and the module settings, added the module code to a template and it worked. Maybe me screenshots help in some way. 2 Link to comment Share on other sites More sharing options...
joeck Posted May 13, 2019 Author Share Posted May 13, 2019 First of all, thank you so much for your reply @wbmnfktr I guess this means I broke something... I'll try on a fresh installation. What confuses me is that I don't get any errror, warnings or notices in any logs Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 13, 2019 Share Posted May 13, 2019 You're welcome. ? I wouldn't create a fresh installation... just start taking things apart. Check your page reference field. Maybe there are no pages, maybe they are hidden, maybe your input type is wrong, maybe whatever. Check if you added the field to the user template and to the module settings. Try another browser, delete your cache... if there were any errors they should show up. Maybe you will find something in your dev console. Link to comment Share on other sites More sharing options...
joeck Posted May 13, 2019 Author Share Posted May 13, 2019 oh boy, turns out that my css library materialize.css sets all the select inputs to display: none ? The select has all the desired data simply not visible due to css... But now i get another error when trying to register with a new account: Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in [no active file]:0 Stack trace: #0 {main} thrown in [no active file] on line 0 Again no logs in Processwire admin or browser console. The registration email actually gets sent out but when you click the link you receive the error message: Unable to complete confirmation, please re-register and try again. Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 13, 2019 Share Posted May 13, 2019 Do you have any custom code somewhere? Maybe in ready.php? Really can't tell where this comes from. What modules do you use? Which version of ProcessWire and PHP? Link to comment Share on other sites More sharing options...
joeck Posted May 13, 2019 Author Share Posted May 13, 2019 yes I have a hook in ready.php that should only apply on a different PageSelect field called team_owner: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'team_owner' && !$this->wire('user')->isSuperUser()) { $permissions = $this->wire('user')->getPermissions(); $authorized_pages = new PageArray(); foreach($permissions as $permission){ if (!$permission->team_owner) { continue; } //skip permissions without team foreach($event->pages->find("template=team") as $page){ if ($page === $permission->team_owner){ $authorized_pages->add($page); } } } $event->return = $authorized_pages; } }); I think this is working as desired, since I see all the options in the dropdown of the registration form field (called team_reference) and if the hook would execute I shouldn't see all the fields in the dropdown. these modules are installled: AdminOnSteroids FieldtypeColorPicker InputfieldCKEditor LoginRegister PageEditFieldPermission TracyDebugger fullcalender.io (not a processwire module) Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 13, 2019 Share Posted May 13, 2019 I don't know if this hook causes the error. Test the registration without that hook to confirm it. Your modules seem to be fine - I guess. Unless you don't use a weird setup with nginx or frameworks of any kind (no, not materialize.css ?) I have no idea where this comes from. Link to comment Share on other sites More sharing options...
dragan Posted May 13, 2019 Share Posted May 13, 2019 Try upgrading Tracy. There's just one other forum thread where the same error message appears. According to @adrian's reply, it could also be because you're using serialize() somewhere in your code. Link to comment Share on other sites More sharing options...
joeck Posted May 13, 2019 Author Share Posted May 13, 2019 I removed the hook but error message still shows. I don't have any setup with nginx or other framework (apart from jQuery but I assume that is not considered weird, nor a framework) Tracy is on version 4.19.13 and apparently up-to-date. No recent tracy logs I haven't found any serialize() in my code and I'm pretty sure I didn't use it since this is the first time I hear about this function, let alone knowing what it does. Link to comment Share on other sites More sharing options...
joeck Posted May 14, 2019 Author Share Posted May 14, 2019 update: If I remove the pageSelect field from the registration form the error no longer shows but the registration process is still not working (not sure why) The problem seems to be on the registration form only. Profile edit works just fine with the pageSelect field. 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