Simple joomla component Helloworld
Moderator: mindphp
-
- PHP Jr. Member
- โพสต์: 11
- ลงทะเบียนเมื่อ: 26/09/2021 7:40 pm
Simple joomla component Helloworld
Hi everybody,
I try to create simple joomla component helloworld. I follow instructions in this tutorial:
https://www.mindphp.com/en/online-tutor ... pment.html
I save data into db, read and list data from db, but when I try to edit data I can't load data from db to the form, the form is show but blank.
I accept any proposal .
I try to create simple joomla component helloworld. I follow instructions in this tutorial:
https://www.mindphp.com/en/online-tutor ... pment.html
I save data into db, read and list data from db, but when I try to edit data I can't load data from db to the form, the form is show but blank.
I accept any proposal .
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41416
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: Simple joomla component Helloworld
pls. show your error.
(Set your joomla Error Reporting => Development )
(Set your joomla Error Reporting => Development )
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Jr. Member
- โพสต์: 11
- ลงทะเบียนเมื่อ: 26/09/2021 7:40 pm
Re: Simple joomla component Helloworld
First, Thanks for your replay!
I set error level to development, but there is no any errors!
When I press button [edit], form is loading but there no information inside, just empty form, like I press [new] button.
Button [new] works OK. New data was saved in db. But edit is not working...
I think, I miss something small and stupid again.
I set error level to development, but there is no any errors!
When I press button [edit], form is loading but there no information inside, just empty form, like I press [new] button.
Button [new] works OK. New data was saved in db. But edit is not working...
I think, I miss something small and stupid again.
-
- PHP Jr. Member
- โพสต์: 11
- ลงทะเบียนเมื่อ: 26/09/2021 7:40 pm
Re: Simple joomla component Helloworld
SOLVED!!!
I checked all files line by line, in model->hello.php in function getForm
i had writed 'loadData' => $loadData
i need to write 'load_data' => $loadData
and now everything is working perfectly!
Special thanks to mindphp for all tutorials and help!
I checked all files line by line, in model->hello.php in function getForm
i had writed 'loadData' => $loadData
i need to write 'load_data' => $loadData
and now everything is working perfectly!
Special thanks to mindphp for all tutorials and help!
-
- PHP Jr. Member
- โพสต์: 11
- ลงทะเบียนเมื่อ: 26/09/2021 7:40 pm
Re: Simple joomla component Helloworld
Another problem. Function delete doesn't works!
When I try to delete record, press button [delete], I receive
a message "Invalid token!".
The first line of function delete() in controllers->hello.php is JRequest::checkToken() or die('Invalid token!');
I understand that the checkToken is fail and execute second part "die".
If I comment first line of delete() /not check for token/,
it's works, the record has been deleted, but I beleve it's not best idea .
I have the same line /checkToken/ in function Save() in the same file, but save is working perfectly, the checkToken is success.
For pity function delete() doesn't works, and I really don't know where is the problem.
Joomla error level is set to development -> no errors, no warnings and no notices.
Line by line reading was not successfully this time...
In views->hello->default.php and views->hellos->default.php at the end
of the two files, there is <?php echo JHtml::_('form.token');?>
Can somebody let me an idea how to find the problem?
P.S. If I change first line from
JRequest::checkToken() or die('Invalid token!');
to
$this->checkToken() or die('Invalid token!');
I receive:
Warning
The security token did not match. The request was aborted to prevent any security breach. Please try again.
When I try to delete record, press button [delete], I receive
a message "Invalid token!".
The first line of function delete() in controllers->hello.php is JRequest::checkToken() or die('Invalid token!');
I understand that the checkToken is fail and execute second part "die".
If I comment first line of delete() /not check for token/,
it's works, the record has been deleted, but I beleve it's not best idea .
I have the same line /checkToken/ in function Save() in the same file, but save is working perfectly, the checkToken is success.
For pity function delete() doesn't works, and I really don't know where is the problem.
Joomla error level is set to development -> no errors, no warnings and no notices.
Line by line reading was not successfully this time...
In views->hello->default.php and views->hellos->default.php at the end
of the two files, there is <?php echo JHtml::_('form.token');?>
Can somebody let me an idea how to find the problem?
P.S. If I change first line from
JRequest::checkToken() or die('Invalid token!');
to
$this->checkToken() or die('Invalid token!');
I receive:
Warning
The security token did not match. The request was aborted to prevent any security breach. Please try again.
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41416
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: Simple joomla component Helloworld
check your Token must have define on your input form. (tree view or form view)
view source tree view page must show like this
view source tree view page must show like this
....
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="3f426740818e081ad77d0e2f78c811ed" value="1" /> </div>
</form>
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Jr. Member
- โพสต์: 11
- ลงทะเบียนเมื่อ: 26/09/2021 7:40 pm
Re: Simple joomla component Helloworld
Yes, in view source in browser I have the same source as yours:
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<input type="hidden" name="c" value="hello">
<input type="hidden" name="filter_order" value="id">
<input type="hidden" name="fiter_order_Dir" value="asc"
<input type="hidden" name="30e884863d0edb8f8fa6b560b325764d" value="1" />
But "Invalid token!" message doesn't disappear...
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<input type="hidden" name="c" value="hello">
<input type="hidden" name="filter_order" value="id">
<input type="hidden" name="fiter_order_Dir" value="asc"
<input type="hidden" name="30e884863d0edb8f8fa6b560b325764d" value="1" />
But "Invalid token!" message doesn't disappear...
-
- PHP Jr. Member
- โพสต์: 11
- ลงทะเบียนเมื่อ: 26/09/2021 7:40 pm
Re: Simple joomla component Helloworld
SOLVED!!!
You are my Best Friend! :-)
When I posted the source from my browser, I sow that I missed a single ">" for last <input before token.
It was very very mysterious error... I spent so many time for a single ">"...
Thank you very much again for your help!
Message
Delete successfully!
You are my Best Friend! :-)
When I posted the source from my browser, I sow that I missed a single ">" for last <input before token.
It was very very mysterious error... I spent so many time for a single ">"...
Thank you very much again for your help!
Message
Delete successfully!
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41416
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: Simple joomla component Helloworld
My pleasure.
I don't like this line
Haha.
I don't like this line
โค้ด: เลือกทั้งหมด
<input type="hidden" name="fiter_order_Dir" value="asc"
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
Re: Simple joomla component Helloworld
iig75 เขียน: ↑01/11/2021 7:15 pm SOLVED!!!
You are my Best Friend! :-)
When I posted the source from my browser, I sow that I missed a single ">" for last <input before token.
It was very very mysterious error... I spent so many time for a single ">"...
Thank you very much again for your help!
Message
Delete successfully!
mindphp เขียน: ↑01/11/2021 6:30 pm check your Token must have define on your input form. (tree view or form view)
view source tree view page must show like this
....
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="3f426740818e081ad77d0e2f78c811ed" value="1" /> </div>
</form>
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 41