Extension talk:CIForms

About this board

Email notification settings clarification

7
School4schools (talkcontribs)

Doing my best to follow instructions for installation/ configuration. I've run the terminal commands and the form works fine w/ output to the special page.

However, I can't figure out email notification settings.

As best I can understand, the proper place to add the user for default email notifications in the file /extensions/CIForms/includes/CIForms.php ? It's the only place I can find 'email to' => null. I changed the null to 'username' but it doesn't produce an email. (I have $wgEnableEmail enabled, and I assumed the terminal command installed PHPmailer (per composer update --no-dev inside the folder extensions/CIForms)

The /extensions/CIForms/vendor/phpmailer seems to have installed ok.

Many thanks for your help. I'm code illiterate and just want my wiki to function properly -- your extension will be a great asset for it. Here for my wiki https://school4schools.wiki

Thomas-topway-it (talkcontribs)

no, it's in LocalSettings.php, as follows:

$wgCIFormsEmailTo = 'your email address';

School4schools (talkcontribs)

Tks for quick reply. That function didn't show in LocalSettings.php I added it manually on last line, but it still doesn't work. So I have now in LocalSettings.php :

wfLoadExtension( 'CIForms' );

define( 'CIFORMS_VALUE_IF_NULL', 0 );

define( 'CIFORMS_VALUE_OVERRIDE', 1 );

define( 'CIFORMS_VALUE_APPEND', 2 );

$wgCIFormsEmailTo = 'name@domain.com';

Thomas-topway-it (talkcontribs)

hello, yes, it is a parameter, it must be added in LocalSettings.php.

Can you also verify thatwgEnableEmail is set to true and the wiki has been already configured for sending emails ?

School4schools (talkcontribs)

That setting is "true" but when I ran a test an email via the special page http://YOURWIKIURL/index.php?title=Special:EmailUser/ it returned a php error. I ran some Cpanel tests and reset DNS, so will see if that changes the behavior by tomorrow. Tks for your help.

School4schools (talkcontribs)

Thank you for your help. I had my host verify email functionality, and they ended up screwing up the DNS... ugh. Now a few weeks later, I fixed it myself w/ full site email functionality, but email still not working on the wiki. So I followed the email troubleshooting guide: Manual:$wgSMTP - MediaWiki to replace the default settings in LocalSettings.php $wgEmergencyContact = "apache@🌻.invalid"; and $wgPasswordSender = "apache@🌻.invalid"; w/ the admin email and it's all working now. Thank you!

Thomas-topway-it (talkcontribs)
Reply to "Email notification settings clarification"

Configuration instructions for notifications

2
School4schools (talkcontribs)

I didn't want to directly edit it, but the Configuration section instructions read:

Insert the following code after wfLoadExtension( 'CIForms' ); in LocalSettings.php (this facilitates setting the global variables listed below)

define( 'CIFORMS_VALUE_IF_NULL', 0 );
define( 'CIFORMS_VALUE_OVERRIDE', 1 );
define( 'CIFORMS_VALUE_APPEND', 2 )

That last line needs a closing semicolon (I think? w/o it it broke my site)

Thomas-topway-it (talkcontribs)

thanks, fixed

Reply to "Configuration instructions for notifications"
Idris, the wise (talkcontribs)

I have mediawiki 1.35.5 installed and I installed the latest 1.2.1 version of the extension.

When I enter the codes, I have the forms and they are working correctly, but their design is as simple as possible and not at all like the pictures.

What is my problem? I had this extension on 1 MW 1.37.1 on a localhost and the graphic design was ok


thnx

Thomas-topway-it (talkcontribs)

@Idris, the wise it could be related to the css, which is not loading. Do you have a screenshot or a link or can you check that the css load correctly ? (for instance hard-refreshing the browser)

Idris, the wise (talkcontribs)

[SOLVED]

Update:

I copied the contents of Style.css (found in /extensions/CIForms/resources/style.css) inside the /index.php/MediaWiki:Common.css.

It is working now


@Thomas-topway-it thanks for the tip to the css load problem

Thomas-topway-it (talkcontribs)

hello @Idris, the wise, I think it's related to the skin chameleon, the resources (css and javascript) are not loading, you can add them manually or I will check it as soon as possible

Idris, the wise (talkcontribs)

@Thomas-topway-it

but I found that this problem reoccurred with other skins too.

However my issue is solved now

I edited my previous comment.

Thomas-topway-it (talkcontribs)

@Idris, the wise but still the Javascript is not loading, so you need to load it in some way

Idris, the wise (talkcontribs)
Thomas-topway-it (talkcontribs)

yes but the validation will not work well

Idris, the wise (talkcontribs)
Thomas-topway-it (talkcontribs)

perhaps yes, but the Javascript select (for long lists of options) will not work

Idris, the wise (talkcontribs)
Thomas-topway-it (talkcontribs)

@Idris, the wise that should have been solved in the latest version! there was a mistake in the js and css module declaration, now fixed

Reply to "Design Problem"

PDF no longer contains field descriptions?

4
Jhollinden (talkcontribs)

I recently updated my mediawiki to 1.38.2, and updated CIForms to the CIForms-master-b50b5aa version.

I've noticed when forms are submitted now, the field descriptions no longer display in the PDF?

For example, I have a form that's is the following:

{{#CI form: title = Testing Suggestion Form | {{#CI form section: type = inputs | [Full Name=text] *}}


Previously the PDF that was emailed would say:


Full Name [ Jason Hollinden ]


But now it just shows as:


[Jason Hollinden]


Has this feature moved to a configuration that I'm missing?

Jhollinden (talkcontribs)

Actually I figured this out. It's when using the Placeholder style of form vs standard. So

Full Name [] * ("Full Name" will display on PDF)

[Full Name] * ("Full Name" wil not display on PDF)

Thomas-topway-it (talkcontribs)

thanks, I will check

Thomas-topway-it (talkcontribs)
Reply to "PDF no longer contains field descriptions?"

Can both this extension & Page Forms be on the same wiki?

2
Christharp (talkcontribs)

My question sums it up.

Thomas-topway-it (talkcontribs)

sure, you can check here Manual:Forms for an overview, the two extensions cover different needs

Reply to "Can both this extension & Page Forms be on the same wiki?"

Submissions page not showing the submitted forms and no notification alerts for the submitted pages

15
Saibgs (talkcontribs)

Hello Team.

we are using CIForms extensions 1.38 version.

we are not able to see the submissions on this page : https://*******/index.php/Special:CIFormsManage.

When we installed the extensions, the tables created without prefix( offcourse 1.38v is having tables without prefix) and these tables doesn't get updated with the submitted data.

So i had to manually create tables with prefix ( mw_) and the tables get updated post form submission.

Now, when we check the submission page under Special:CIFormsManage , can't see the submission data..... out of interest i did go and reloaded the data from mw_CIForms* tables to CIForms tables .. then i can see submission data. I think still MW is referring the without prefix tables rather than the tables with prefix.

I see from old tickets that this prefix issue was fixed in master build but it was not released in version, currently the way we setup the MW on k8s is to install the extensions basis the version tag....

Could you please help me on how to fix the issue ? will I need to update any config to tell MW to use prefix tables.

Thanks

Sainath

Saibgs (talkcontribs)

I have downloaded master build and it works fine, but i cannot download the form from submissions page is this some issue in the code ?

Thomas-topway-it (talkcontribs)
Saibgs (talkcontribs)

@Thomas-topway-it

Thanks for the update, yes i used the CIForms-master* and it is working fine.

under the submissions page -> we can see the submitted forms here --> click on action:view , where you can see all forms and download them..but sometimes the download button is not working if i refresh then it works.Unable to attach the screenshot.

Also, i wanted to use email notification to be sent when every there is a form submission done, i am using this ($wgCIFormsEmailTo) parameter in the localsettings.php but it is not working. i have smtp configured and working fine but not the submission alerts.

Thomas-topway-it (talkcontribs)

@Saibgs regarding email notification you have to run composer update --no-dev inside the folder extensions/CIForms, regarding the issue with the download button I'm not sure, it does not depend by Javascript so page reload shouldn't affect

Saibgs (talkcontribs)

Thnaks @Thomas-topway-it.


Below are the results after ruunning the composer update --no-dev


php /tmp/composer.phar update --no-dev

931Loading composer repositories with package information

932Info from https://repo.packagist.org: #StandWithUkraine

933Updating dependencies

934Lock file operations: 0 installs, 6 updates, 0 removals

935 - Downgrading psr/container (2.0.2 => 1.1.2)

936 - Downgrading psr/log (2.0.0 => 1.1.4)

937 - Upgrading symfony/console (v5.4.10 => v5.4.11)

938 - Downgrading symfony/deprecation-contracts (v3.1.1 => v2.5.2)

939 - Downgrading symfony/service-contracts (v3.1.1 => v2.5.2)

940 - Downgrading symfony/string (v6.1.2 => v5.4.11)

941Writing lock file

942Installing dependencies from lock file

943Nothing to install, update or remove

944Generating autoload files


and added $wgCIFormsEmailTo to the localsetting.php.

But i don't see any email received after submitting a test form. Do i need to change/update any config ?


Thanks

Thomas-topway-it (talkcontribs)

ok, let me check ...

Thomas-topway-it (talkcontribs)
Saibgs (talkcontribs)
Thomas-topway-it (talkcontribs)

hello @Saibgs it seems the right branch, so if you are using it or you have replaced the file includes/specials/CIFormsSubmit.php it should work fine.

Can you ensure that this line $local = preg_split( "/\s*,\s*/", $local, -1, PREG_SPLIT_NO_EMPTY ); is present ?

If so, and still it does not work, can you insert var_dump($submit_valid);

before the first occurrence of $success = false;

in the same file. This should inform you if the email has been correctly parsed. Also, can you send your configuration (limited to the CIForms parameters in LocalSettings.php) to thomas.topway.it@mail.com so I can check it ?

Saibgs (talkcontribs)

Hello @Thomas-topway-it ,

Sorry for delay.

Below is the part of code after insert "var_dump($submit_valid);"


foreach ( $formSubmit as $email ) {

var_dump($submit_valid);

if ( Sanitizer::validateEmail( $email ) ) {

$submit_valid[] = $email;

}

}

$success = false;


also, I have sent a email ( from: saichi@bgs.ac.uk ) with limited to CIForms.


after adding all the bit in the code, I tested a submission and got below error.


Error:

/var/www/html/Special:CIFormsSubmit, referer: https://SITE/index.php/Feedback                                            │

│ sh: 1: /usr/sbin/sendmail: not found                                                      


I did see the same error before when I was testing forgot password functionality where "set_include_path('/opt/www-scripts')" in Localsettings.php was causing the problem and after removing it resolved the issue. Not sure why i am seeing that again.


Thanks

Sainath

Thomas-topway-it (talkcontribs)

what is the output of var_dump($submit_valid); ?

by the way it seems a server config error, related to sendmail, are you able in general to send email with your server ?

Saibgs (talkcontribs)

hello @Thomas-topway-it,


Sorry for delay, not able to progress on this issue as i am getting on 504 gateway time out once i clock on submit on feedback form. all my network is allowed and no restrictions but still i see this issue stopping me to debug the email alerts.

Thomas-topway-it (talkcontribs)

It could be related to PhpMailer

https://github.com/PHPMailer/PHPMailer

perhaps can you create a separate script and try to send an email manually ? (through the script) so you know if it is related to PhpMailer on your system

This post was hidden by Thomas-topway-it (history)
Reply to "Submissions page not showing the submitted forms and no notification alerts for the submitted pages"
Jhollinden (talkcontribs)

I'm not seeing a list of input types available? From the examples I've seen textarea, email, number, and tel. The tel one doesn't seem to do anyting? Just wanted to see if there was a full list of options for input types?


Thanks!

Thomas-topway-it (talkcontribs)

currently textarea and select are rendered separately, while the other ones, like text, email, date, etc. are rendered as a standard input with the chosen type. You can find here a list

https://www.w3schools.com/html/html_form_input_types.asp


so it mainly depends by the browser, date works well, I haven't tested all of them, with "tel" the browser should prevent to insert letters ? (of course using "submit", "button", or "checkbox" does not make sense, perhaps I have to filter/restrict the list, while "file" could be added in future)

Reply to "List of input types?"

Problem with table name

4
Brunodapei (talkcontribs)

When i try to read Submissions special page it founds an error because it looks for the table "CIForms_submissions" without the prefix name (in my case: mw_)

Thomas-topway-it (talkcontribs)

@Brunodapei yes, this is also solved in the latest version

Brunodapei (talkcontribs)

grazie!

Saibgs (talkcontribs)

hello, in which version this is fixed? thanks

Reply to "Problem with table name"

Translating / where to edit

5
212.23.139.2 (talkcontribs)

Hey, thank you for this great extension, by testing right now, I was wondering if it would be possible to change the text in the "Form Submission Page" and the "Submissions Spezial Page" ?

Thomas-topway-it (talkcontribs)

You can edit the messages in the file i18n/en.json

I suggest you to upgrade to the latest version ! (1.2.1)

Brunodapei (talkcontribs)

and how can i edit the message "submit" (the text of the button), please?

Thomas-topway-it (talkcontribs)

@Brunodapei hello, I did a major update to CIForms, now labels of buttons can be edited from the form descriptor. You can check the full list of new features in the main page of the extension.

Brunodapei (talkcontribs)

grazie!

Reply to "Translating / where to edit"

Compatibility with Postgres?

6
YahboobayYahboobay (talkcontribs)

Im getting this error when trying to submit a CIForm:

Error 42P01: relation "CIForms_submissions" does not exist

I've successfully followed all the installation steps (I did skip step 2: "Run composer update inside the folder extensions/CIForms" because i dont need the email functionality).

We are using Postgres and it looks like CIForms.php is only making the the DB changes if mysql is being used?

Is it correct that only mysql is supported? if so, what would it take to get this working with Postgres?

Thanks in advance!

YahboobayYahboobay (talkcontribs)

Update: I've been able to get Forms to submit successfully by

1. translating the two files in "CIForms/sql/" from mysql to postgres

2. making some minor changes to "CIForms/includes/specials/CIFormsSubmit.php" & "CIForms/includes/specials/CIFormsManage.php" (changing any references to the "CIForms..." tables to lower case i.e. "ciforms...")

But now i get a new database error when trying to view the results at Special:CIFormsManage:

Error 42803: ERROR: column "ciforms_submissions.id" must appear in the GROUP BY clause or be used in an aggregate function

LINE 1: SELECT /* CIFormsManage::reallyDoQuery */ ciforms_submissio...


Function: CIFormsManage::reallyDoQuery

Query: SELECT ciforms_submissions.*,

COUNT(*) as submissions,

(SELECT MAX(created_at)

FROM ciforms_submissions as b

WHERE b.title = ciforms_submissions.title


) as last_submission_date,

SUM(CASE WHEN shown IS NULL THEN 1 ELSE 0 END) as new

FROM ciforms_submissions


GROUP BY ciforms_submissions.page_id, ciforms_submissions.title

ORDER BY last_submission_date DESC LIMIT 51 OFFSET 0


It seems to originate from the database query that results from line 413 in "CIForms/includes/specials/CIFormsManage.php"

Im afraid i've reached the limits of my troubleshooting capabilities. Do you have any ideas to help me view the results in given our Postgres database?

Thanks again!

YahboobayYahboobay (talkcontribs)

Update #2:

I changed line 457 in "CIForms/includes/specials/CIFormsManage.php" to:

GROUP BY ciforms_submissions.id, ciforms_submissions.page_id, ciforms_submissions.title


and now i can view the results! So it seems to be working now.

Thomas-topway-it (talkcontribs)

@YahboobayYahboobay thanks for reporting, so the issue is related to camelcase table names, right ?

YahboobayYahboobay (talkcontribs)

@Thomas-topway-it, Sorry that my comments may have been hard to follow, I wasn't able to properly format the update comments. To summarize, in the end, there were four things to get it working with Postgres:

  1. The two .sql files had to be translated from Mysql to Postgres. (CIForms_submissions.sql and CIForms_submissions_groups.sql)
  2. Then there's the capitalization issue (postgres apparently defaults to lower case) which required changing all sql references to the database table "CIForms_..." to "ciforms_..." (in CIFormsManage.php and CIFormsSubmit.php)
  3. Finally one small change to line 457 in CIFormsManage.php made an "ERROR: column must appear in the GROUP BY clause or be used in an aggregate function" error go away. This was changing GROUP BY ciforms_submissions.page_id, ciforms_submissions.title to GROUP BY ciforms_submissions.id, ciforms_submissions.page_id, ciforms_submissions.title
  4. adjust the if statement on line 130 of CIForms.php which checks for mysql before proceeding


Hopefully that helps? Thank you for the great work on this extension!

Thomas-topway-it (talkcontribs)

@YahboobayYahboobay thanks for your notes, I've included them in the latest version. Can you check that everything work fine on your side ? You'll also find the full list of new features in the main page of the extension.

Reply to "Compatibility with Postgres?"
Return to "CIForms" page.