开发者

Joomla: Post form fields from module to component

开发者 https://www.devze.com 2023-03-31 19:37 出处:网络
I am a beginner to Joomla development. I have developed a rating module which looks as below. I have managed to get the ratings from my database, but I do not know how to insert into the database w

I am a beginner to Joomla development. I have developed a rating module which looks as below.

Joomla: Post form fields from module to component

I have managed to get the ratings from my database, but I do not know how to insert into the database when user clicks the vote button.

I have a form in my module which contains the four drop down boxes and a submit button (Vote). Now I am planning to develop a component in order to process t开发者_JAVA百科his form data. How should I develop my component to process this? And what should be the form action in my module?

Any help is appreciated. Thanks in advance.


Create component http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1 Create module http://docs.joomla.org/Creating_a_simple_module

you must specify action of your module with JRoute http://docs.joomla.org/Supporting_SEF_URLs_in_your_component

look at component code example

$controller->execute( JRequest::getWord( 'task' ) );

so you must create controller and special task method for processing data

If you don't need component at all you can put logic in your module In this way module should have form action to current page and process logic something like

$elements = JRequest::getVar('vote_data', array(), 'post');
if(count($elements)) {
   // do something
}
0

精彩评论

暂无评论...
验证码 换一张
取 消