User Rating: 1 / 5

Star ActiveStar InactiveStar InactiveStar InactiveStar Inactive
 

later to see the changes.

- edit files in the folder hello.php Edit Controllers Add Method.

Com_helloworld/Controllers/hello.php

function edit()
 {

      JRequest:setVar('view', 'hello');
      parent::display();

 

- Modify the files in the folder hello.php Models.

com_helloworld/models/hello.php

public function getItem()
{
        $pk = JRequest::getVar('cid');
        if(is_array($pk)) {
                $pk = $pk[0]; 
        }
        if($pk == '') {
                return false; 
        }
        $db = JFactory::getDbo();     
        $query = $db->getQuery(true);
        $query->select('*')
                ->from('#__helloworld_hello')
                ->where($db->quoteName('id').'='.$db->quote($pk));
        $db->setQuery($query);
        $db->query();
        return $db->loadObject(); // ส่งค่าออกไปในรูปของ Object
}
protected function loadFormData()
{
        $data = $this->getItem();
        return $data;
}
function save($data) 
{
        $db = JFactory::getDbo();
        $obj = (object) $data;
        try {
                if($obj->id) { 
                        $db->updateObject('#__helloworld_hello', $obj, 'id');
                } else {
                        $db->insertObject('#__helloworld_hello', $obj, 'id');
                }

        } catch (RuntimeException $exc) {                
                $this->setError($exc->getMessage());
                return false;
        }
        return true;
}

 

- Modify the files in the folder hello.xml models / forms to id is hidden.

com_helloworld/models/forms/hello.xml

<?xml version="1.0" encoding="utf-8"?>
<form>
        <fieldset name="hello_form">
                <field 
                        name="id"
                        type="hidden"
                />            
                <field 
                        name="name" 
                        type="text"
                        class="inputbox"
                        label="Name"
                        required="true"
                />
                <field 
                        name="detail" 
                        type="textarea"
                        class="inputbox"
                        label="Detail"
                        required="true"
                        rows="5"
                />
        </fieldset>
</form>

 

 

Chapter 13 - Delete Data Component Development

Recent Topics
Subject
Post Reply
Open
Recent
Features Review : Plugin Editors XTD Multicontent membantu dlm mengeluarkan artikel dari Master Site ke Web Clien
By abdkode Fri 15 Feb 2019 2:40 pm Board Bahasa Language
0
4008
Fri 15 Feb 2019 2:40 pm By abdkode
Webmaster에서 Webclient로 데이터 배포를 위한 M MultiSite Content Components 소개
By wipaporn Fri 15 Feb 2019 2:22 pm Board korean Language - 한국어
0
6545
Fri 15 Feb 2019 2:22 pm By wipaporn
마스터 사이트의 도메인 이름 기록을 위한 M MultiSite Content client 소개
By wipaporn Fri 15 Feb 2019 2:20 pm Board korean Language - 한국어
0
9513
Fri 15 Feb 2019 2:20 pm By wipaporn
Mod MD recent 모듈을 소개 한다. phpb 보드는 ๋Joomla에서 보여준다.
By wipaporn Fri 15 Feb 2019 2:18 pm Board korean Language - 한국어
0
1813
Fri 15 Feb 2019 2:18 pm By wipaporn
MDEmbed를 소개한다. 플러그 인에는 링크를 만들고, 비디오, 기사를 업로드하기 위한 버튼이 있으며, 웹 사이트인 Joomla 2.5, 3.x
By wipaporn Fri 15 Feb 2019 2:14 pm Board korean Language - 한국어
0
1781
Fri 15 Feb 2019 2:14 pm By wipaporn
介绍 M MultiSite Content Components,用于将数据从网站管理员分发到Web客户端
By wipaporn Fri 15 Feb 2019 2:01 pm Board Chinese Language - 简体中文
0
13694
Fri 15 Feb 2019 2:01 pm By wipaporn
介绍M MultiSite Content client Components 记录主站点域名
By wipaporn Fri 15 Feb 2019 1:59 pm Board Chinese Language - 简体中文
0
17236
Fri 15 Feb 2019 1:59 pm By wipaporn
介绍mod md recent模块。PHPBB板显示在Joomla上。
By wipaporn Fri 15 Feb 2019 1:54 pm Board Chinese Language - 简体中文
0
18788
Fri 15 Feb 2019 1:54 pm By wipaporn
介绍MDEMBED。该插件有创建链接、上传视频、文章、网站joomla 2.5、3.x的按钮。
By wipaporn Fri 15 Feb 2019 1:52 pm Board Chinese Language - 简体中文
0
10228
Fri 15 Feb 2019 1:52 pm By wipaporn
Introducing MApplication Form Components. Job application forms via the website.
By wipaporn Fri 15 Feb 2019 11:14 am Board English Language
1
3553
Tue 15 Oct 2019 1:20 pm By mindphp
Features Review : Mod MDFiles Categories bantu memaparkan Kategori MDFiles
By abdkode Thu 14 Feb 2019 6:13 pm Board Bahasa Language
0
7114
Thu 14 Feb 2019 6:13 pm By abdkode
Introducing Mod MDFiles Featured MDFiles popular modules bring files from MDFile to show.
By wipaporn Wed 13 Feb 2019 6:51 pm Board English Language
0
15488
Wed 13 Feb 2019 6:51 pm By wipaporn
Introducing MDFiles Featured modules bring files from MDFile to show
By wipaporn Wed 13 Feb 2019 6:34 pm Board English Language
0
2553
Wed 13 Feb 2019 6:34 pm By wipaporn
Introducing Editors XTD Multicontent, a plugin for pulling articles from Master Site into Web Clien.
By wipaporn Wed 13 Feb 2019 6:05 pm Board English Language
0
6036
Wed 13 Feb 2019 6:05 pm By wipaporn
Introducing MJUpgrade for upgrading Joomla 1.5 to Joomla 2.5, 3.X
By wipaporn Wed 13 Feb 2019 6:03 pm Board English Language
2
1478
Wed 01 Apr 2020 6:51 pm By prmindphp
Introducing the Mod vinaora visitors counter for counting website visits in joomla
By wipaporn Wed 13 Feb 2019 6:01 pm Board English Language
0
1548
Wed 13 Feb 2019 6:01 pm By wipaporn
Introducing MVDO plugin for uploading Youtube videos and Clipmass
By wipaporn Wed 13 Feb 2019 5:58 pm Board English Language
0
1420
Wed 13 Feb 2019 5:58 pm By wipaporn
Introducing MD Gallery Components for creating photo galleries on Joomla 3.x website
By wipaporn Wed 13 Feb 2019 5:54 pm Board English Language
13
8118
Tue 31 Mar 2020 6:37 pm By prmindphp
Plugin MD Watermark 소개, 자동 워터마킹용 플러그
By wipaporn Wed 13 Feb 2019 3:53 pm Board korean Language - 한국어
0
2427
Wed 13 Feb 2019 3:53 pm By wipaporn
PayToRead 소개. 플러그인은 일부 텍스트만 보여준다.
By wipaporn Wed 13 Feb 2019 3:51 pm Board korean Language - 한국어
0
1800
Wed 13 Feb 2019 3:51 pm By wipaporn