Recently Browsing 0 members
No registered users viewing this page.
i'm running into a funny little issue
i'm working on a multilingual website, default is English, second language French
in this website i've a form for visitors to submit an event, title, date and so on, when they submit the event, it's stored into a personnal db table
i've created a module in the admin where admins (well, of course 🙂 ) can't validate or delete the submitted events, thanks to pw, it works like breeze except for one little thing 🙂
when an admin validate an event, i use the pw api to create a page and fill all the new page fields, among which
$p = new Page(); $p->of(false); .... $p->title = $titre; $titre being the title of the event submitted and retreived from the database
the thing is that depending of the language of the admin it fills the title in English/the default language or in French if the admin language is French and what i'm looking for is to always fill the default language title whatever the admin language is, guess, to take advantage of the auto filling of other languages when the default one is filled
Funny enough i've solved the opposite problem with a multilingual select form field, using
$filters = $fieldtypes->get('FieldtypeOptions')->getOptions('filtres'); foreach($filters as $f): ... echo $f->title; // it always echo the default language option title // using this echo $liso == 'fr' ? $f->title1019 : $f->title; // i've got the right select options titles displayed in the select // of course, $liso is defined in the _init.php $langid = $user->language->id; $langiso = array(1017 => 'en', 1019 => 'fr'); $liso = $langiso[$langid]; in case anybody has an idea about this page creation 🙂
i keep searching
have a nice day
first of all, as it's my first post here, thanks so much for this incredible CMS, thanks for all my question i've found answers here without even asking them and, of course, i can't say thanks enough to Ryan incredible job...
i'm currently working on a bilingual website (pw 3.0.165 php 7.2), funny enough (i'm french), this time default language is english and the second one french but i think that doesn't matter...
this website stores events and i have an page having itself all the events as hidden chidren pages, template for an event is... un_event with many fields, some of them bilingual
as i'm supposed to display the number of events available on all the pages at different places ("see the xx events" with a link to the event page) in my _init.php file i've set a count of the one_event pages and this is where the funny thing is
$nevents = $pages->count('template=un_event, include=hidden'); // in the default language see the <?php echo $nevents; ?> language works fine // in french $nevents is 0 $nevents = $pages->count('template=un_event, include=all'); // works fine in both languages but implies that even unpublished pages would be taken in account just to be complete, same behaviour with count($pages->get(1032)->children) count($pages->find('template=un_event, include=hidden')) and so on, in english, correct number as the result, in french 0
as a test, wondering if it was the fact that this was in the _init.php file, same thing if i use the same code on top of a page (all my files have the namespace processwire statement on top, i'm essentially a php guy 🙂)
other test, i've done the same thing but setting all the one_event pages as visible (not hidden), same result
is there something i haven't undestood or have forgotten with this all/hidden option when it comes to multilingual websites? probably 🙂
have a nice day
Running into an odd error that I can't seem to get my head around.
We have 2 separately created Formbuilder forms sitting on a single page.
But we keep experiencing weird results with them, originally we couldn't get one of the forms to ever submit so we ended up disabling CSRF for them which let us get around this issue.
However it then causes a problem in that with CSRF disabled, one of forms always records 2 entries on submission. Just a straight duplicate within the entries for that form.
So trying to stop this happening we tried enabling CSRF again and although that does stop the duplicated entry, it ends up giving really weird feedback such as the attached screengrab.
Hazarding a guess I assume whatever is trigger on submission is firing twice because of the presence of the second form, but I have no idea why this would be the case as they are 2 seperately named forms?
I have the same form on multiple pages, the idea being that I can populated a hidden field with a page specific value automatically.
I figured this should be reasonably straight forward but I can't seem to get the following to take effect.
<?php echo $forms->embed ('my-form-name', array('hidden_field_name' => '666')); ?> No matter what I do, it never updates the default value currently set for said hidden field.
Feels like I'm missing something really obvious?
I have a a form in my site footer that can be accessed anywhere on site, I've added the form in the _inc.php file and added the render in the pages footer.php. However, this works well on the homepage e.g. you can submit said form and get a thank you on reload, doesnt work at all on other pages... Just lots like a fresh reload. Any thing im doing wrong here or ways to diagnose as there isn't an error log for formbuilder etc...?