- Posts: 8
- Thank you received: 0
Subscription form: How to enter a script-tag (head)
- Marco Papousek
- Topic Author
- Offline
- New Member
Less
More
1 year 1 month ago #162231
by Marco Papousek
Subscription form: How to enter a script-tag (head) was created by Marco Papousek
I made an override template called "default.php" for the form in "templates/yootheme/html/com_osmembership/register" and entered the script-tag at the bottom (after the form-tag), but the script doesn't work. All I get is the error I found via Console-Search. The script should load a ref-tag in a write-protected form-field with a specific id. It worked with another form-component but not with membership pro form?
How or where can I add this script-tag in the head of the form (using Joomla 4 and Yootheme Pro as a template)?
How or where can I add this script-tag in the head of the form (using Joomla 4 and Yootheme Pro as a template)?
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Away
- Administrator
1 year 1 month ago #162236
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Subscription form: How to enter a script-tag (head)
Hi Marco
Do you want to load JS file somewhere? Or you want to add to add javascript code to the page?
Tuan
Do you want to load JS file somewhere? Or you want to add to add javascript code to the page?
Tuan
Please Log in or Create an account to join the conversation.
- Marco Papousek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
1 year 1 month ago - 1 year 1 month ago #162239
by Marco Papousek
Replied by Marco Papousek on topic Subscription form: How to enter a script-tag (head)
I need to add the javascript directly on the page with the form. Is it possible to integrate the form also via plugin-code in an atrticle? This way I could try to manage to add the script via the YoothemePro-Setting of the page.
Please take a look at the form (how it should be) on www.meinspenden.club/id - here you can see the working test form: www.meinspenden.club/id2?200test .... if you send link without id-number the field should be invisible: www.meinspenden.club/id2
Please take a look at the form (how it should be) on www.meinspenden.club/id - here you can see the working test form: www.meinspenden.club/id2?200test .... if you send link without id-number the field should be invisible: www.meinspenden.club/id2
Last edit: 1 year 1 month ago by Marco Papousek.
Please Log in or Create an account to join the conversation.
- Marco Papousek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
1 year 1 month ago - 1 year 1 month ago #162245
by Marco Papousek
Replied by Marco Papousek on topic Subscription form: How to enter a script-tag (head)
Meanwhile I also tried the module version of the subscription form, but sadly the script is not showing either:
www.meinspenden.club/verein#foerdermitgliedschaft
Last edit: 1 year 1 month ago by Marco Papousek.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Away
- Administrator
1 year 1 month ago #162247
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Subscription form: How to enter a script-tag (head)
Without seeing the script you want to add, it is hard for me to give you the right answer. However, in Joomla, you can use the two methods below to add javascript code to certain page:
$document = \Joomla\CMS\Factory::getDocument();
- To add javascript code, uses addScriptDeclaration method
$document->addScriptDeclaration('var siteUrl = " joomdonation.com ";');
- To add a javascript file, uses addScript method
$document->addScript(' domain.com/js/filename.js ');
In short, you will need to modify code of the subscription form. Maybe add it to components/com_osmembership/view/register/tmpl/default_js.php
(Once the change is done, it should be moved to template override so that the change won't be lost when you update to future releases of the extension)
Regards,
Tuan
$document = \Joomla\CMS\Factory::getDocument();
- To add javascript code, uses addScriptDeclaration method
$document->addScriptDeclaration('var siteUrl = " joomdonation.com ";');
- To add a javascript file, uses addScript method
$document->addScript(' domain.com/js/filename.js ');
In short, you will need to modify code of the subscription form. Maybe add it to components/com_osmembership/view/register/tmpl/default_js.php
(Once the change is done, it should be moved to template override so that the change won't be lost when you update to future releases of the extension)
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- Marco Papousek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
1 year 1 month ago - 1 year 1 month ago #162273
by Marco Papousek
Replied by Marco Papousek on topic Subscription form: How to enter a script-tag (head)
Thank you for the information. We could implement the script and our system is working now.
Thank you very much for your help!
Thank you very much for your help!
Last edit: 1 year 1 month ago by Marco Papousek.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Away
- Administrator
1 year 1 month ago #162277
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Subscription form: How to enter a script-tag (head)
Great. Happy to hear that and thanks for the update. Please note that all the changes to the extension should be implemented using override so that it won't be lost when you update to future releases
Regards,
Tuan
Regards,
Tuan
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2024 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.