e107help.org Q&A
0 like 0 dislike

Sorry, but somehow I'm too stupid for forms. Nothing happens, the manual does not help. What is wrong here? Can maybe someone finally write instructions that also help? With something like this but you can not do anything:

$frm->button($name,$value,$action,$label,$options);

Here is my form, displayed nothing.

        public function createCatPage()
        {
            $sql = e107::getDb();
            $ns = e107::getRender();
            $frm = e107::getForm();
            
            if(isset($_POST['CatToDB']))
            {
                
            }
            else
            {
                $frm -> open('CatCreate', 'post', e_REQUEST_URI, array('autocomplete' => 'on', 'class' => 'formclass'));
                $frm->text('category', '', 50, array('size' => 'large'));
                $frm->button('CatToDB', LAN_PLUGIN_KK_VIDEO_05);
                $frm->close();
            }
            $ns->tablerender(LAN_PLUGIN_KK_VIDEO_02, $text);    
        }

e107 version v2.1.1
in Plugins by (45 points) 3 4 5
edited by

5 Answers

0 like 0 dislike
You have it returing $text but nothing you have listed is $text so nothing will be displaying, either add $text = $frm; or change $text in $ns->tablerender(LAN_PLUGIN_KK_VIDEO_02, $frm);
by (459 points) 17 37 50

I give up, e107 :: getForm (); has not work for me from the beginning. The change of you did not help, it appears no form. I write my forms from now itself, a great pity, it would have made a lot of work unnecessarily. The text for LAN_PLUGIN_KK_VIDEO_02 appears, no more.
I've said it, I'm too stupid.

        // neue Kategorie erstellen
        public function createCatPage()
        {
            $sql = e107::getDb();
            $ns = e107::getRender();
            $frm = e107::getForm();
            
            if(isset($_POST['CatToDB']))
            {
                
                $ns->tablerender(LAN_PLUGIN_KK_VIDEO_01, $text);
            }
            else
            {
                $frm -> open('CatCreate', 'post', e_REQUEST_URI, array('autocomplete' => 'on', 'class' => 'formclass'));
                $frm->text('category', '', 50, array('size' => 'large'));
                $frm->button('CatToDB', LAN_PLUGIN_KK_VIDEO_05);
                $frm->close();
                $ns->tablerender(LAN_PLUGIN_KK_VIDEO_02, $frm);
            }
        }

1 like 0 dislike
The issues you are having are caused by a combination of a lack of documentation and a lack of coding skills.

Please take a look at this code. https://gist.github.com/Moc/ca16e20514db06619d5bda5e34702dec
I have also added a screenshot.

Now, if this is for the admin area, I strongly suggest using the plugin builder that e107 has. It is a great tool to automatically create your entire admin area.

Hope this helps.
I'll update the form class documentation as soon as possible.
by (2.8k points) 7 10 10

I do not understand the admin config.php. Have the template taken from the plugin _blank what I IMHO not needed, deleted. The features are not yet finished, I wanted to see if the form here works only. In the original is a form class, I just do not know what to do with it. I need the forms but where I wrote them. Texts $ text are only dummies to see if something happens when I click the links in $ adminmenu.

This here is what I have:

<?php

// das Herz einbinden
require_once("../../class2.php");
if (!getperms("P"))
{
    e107::redirect('admin');
    exit;
}

// Sprachdatei
include_lan(e_PLUGIN.'kk_videos/languages/'.e_LANGUAGE.'_admin.php');

class plugin_kk_video_admin extends e_admin_dispatcher
{
   
    protected $modes = array(
        'main'        => array('controller' => 'plugin_kk_video_admin_ui',
        'path'         => null,
        'ui'         => 'plugin_kk_video_admin_form_ui', 'uipath' => null)
    );

   
    protected $adminMenu = array(
        'main/listCat'            => array('caption'=> LAN_PLUGIN_KK_VIDEO_01, 'perm' => '0'),
        'main/createCat'         => array('caption'=> LAN_PLUGIN_KK_VIDEO_02, 'perm' => '0'),
        'other'                 => array('divider'=> true),
        'main/listVid'             => array('caption'=> LAN_PLUGIN_KK_VIDEO_03, 'perm' => '0'),
        'main/createVid'        => array('caption'=> LAN_PLUGIN_KK_VIDEO_04, 'perm' => '0')
    );

   
    protected $adminMenuAliases = array(
        'main/edit'    => 'main/list'
    );

   
    protected $menuTitle = LAN_PLUGIN_KK_VIDEO_MENUTITLE;
}

class plugin_kk_video_admin_ui extends e_admin_ui
{
        // required
        protected $pluginTitle = LAN_PLUGIN_KK_VIDEO_NAME;

        /**
         * plugin name or 'core'
         */
        protected $pluginName = LAN_PLUGIN_KK_VIDEO_NAME;
        
        public function listCatPage()
        {
            $sql = e107::getDb();
            $ns = e107::getRender();
            $text = "Ich bin die ListCat-Seite";
            $ns->tablerender("Hello",$text);    
        }
        
        // neue Kategorie erstellen
        public function createCatPage()
        {
            $sql = e107::getDb();
            $ns = e107::getRender();
            $frm = e107::getForm();
            
            if(isset($_POST['CatToDB']))
            {
                
            }
            else
            {
                $frm -> open('CatCreate', 'post', e_REQUEST_URI, array('autocomplete' => 'on', 'class' => 'formclass'));
                $frm->text('category', '', 50, array('size' => 'large'));
                $frm->button('CatToDB', LAN_PLUGIN_KK_VIDEO_05);
                $frm->close();
                $ns->tablerender(LAN_PLUGIN_KK_VIDEO_02, $frm);
            }
            //$ns->tablerender(LAN_PLUGIN_KK_VIDEO_02, $text);    
        }
        
        public function listVidPage()
        {
            $sql = e107::getDb();
            $ns = e107::getRender();
            $text = "Ich bin die ListVideo-Seite";
            $ns->tablerender("Hello",$text);    
        }
        
        public function createVidPage()
        {
            $sql = e107::getDb();
            $ns = e107::getRender();
            $frm = e107::getForm();
            $text = "Ich bin die Erstelle Video-Seite";
            $ns->tablerender("Hello",$text);    
        }
}

new plugin_kk_video_admin();

require_once(e_ADMIN."auth.php");

e107::getAdminUI()->runPage();

require_once(e_ADMIN."footer.php");

?>

Again, you should use the plugin builder to create the admin area of your plugin. This will automatically create the code you need. This way, it's actually far easier to understand the code.

The plugin builder can be found here: /e107_admin/plugin.php?mode=create
0 like 0 dislike
I know where the plugin builder, I also do not understand him. He asks me for fields, what should I tell him? I am beginning to despair of the new system of e107, but the v 1.0.4 does not work for me (PHP 5.6, problems with the output). So I have to use the v2. My problem is that there is no useful documentation. I do not want machines a la plugin builder, I want to understand the system. Only then I can bring the system to do what I want.
by (45 points) 3 4 5

It ask you for fields and you don't understand? The fields will display as the form you want your admin to see and do with.

I use the plugin builder most of the time for the forms, then go off on my own for other stuff in the admin area. Check out some of these repos I've uploaded, check out the admin_config.php:

 

https://github.com/LaocheXe/Falling-Holidays-eXeSystem

https://github.com/LaocheXe/SquadXML-PHP

https://github.com/LaocheXe/Voice-eXeSystem

https://github.com/LaocheXe/Unit-eXeSystem

https://github.com/LaocheXe/SWTOR-Server-Status

 

In the Unit-eXeSystem it would list more than one admin config, while the Voice-eXeSystem has more in the admin_config the any of the others. Then you got SquadXML which has the Plugin Site Prefs and plugin settings... Let me know if this is helpful to you or not.

0 like 0 dislike
I have a database that I write my queries, not some machine. I need more forms and I write. If the form handler does not work when you initialize it, ok, then do not. I write these things up further by you. It is a pity that the date-picker then can not use. So that I can live.
I think I'll look around for another system that does not require me what I like to do.
by (45 points) 3 4 5
0 like 0 dislike
I wouldn't blame it on system. This is example of old plugin that don't use new admin UI features (not uses plugin builder) and it still works and it's able to use old form ($rs) combination with new form  ($frm)  - just for datepicker field.

https://github.com/Jimmi08/content/blob/master/handlers/content_form_class.php

You can still use old way, new way, custom code, generated administration. Flexibility and freedom of e107 is sometimes amazing (mainly with comparing other CMS)

$frm elements/methods are just partial html code, so you needs these parts to get together in variable $text and then use $text in tablerender function.

From I see above you don't use it correct way. $frm is class(object). If you look at other plugins f.e. chatbox_menu, you would see that you need to use variable, not array and when you put all parts of your form to one text variable (one html output), then you can render it.

    $text .= $frm->

If you use f.e. print_a($frm) you would see what you are trying to display and you would see that you are doing something wrong.

Sorry, but this has nothing with e107 and lack of documentation. Old form handler worked the same way (just source was different), you can find $rs variable in old code. New plugin builder just saving time with manually coding forms, but if you want to it manually, you still can.
by (2.0k points) 18 48 58
Just for anyone reading along: $rs is deprecated and I can guarantee you that it will be removed in a future version. Please use the new form handler and report any issues or questions.
996 questions
1,389 answers
2,527 comments
2,512 users