Solved

How can i get the results of a JHTML select.genericlist in a Joomla Module

Posted on 2012-12-25
4
1,877 Views
Last Modified: 2013-01-24
Need to develop a simple Joomla 2.5 Modul with the following JHTML and Text Input:
1. two JHTML::'select.genericlist...class='inputbox'....
2. two normal input boxes (one->number other=text)
3. a SubmitButton if pressed prints the Result of the above entered values
5.  with the above values i must assemble a call to an external server
4. print the answer of the external server
The conventional form with <form method="post" and $_POST['submit'] does not work in a Joomla module. Can any body help?
0
Comment
Question by:Solenthaler
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:mcnute
ID: 38720990
you can install a plugin like sourcerer

after the install you'll have to enable the superadministrator to insert php or html code in joomla content, modules, etc. This is by default disabled also for super admins.

How to enable php, html insertion in joomla content is described here
0
 

Author Comment

by:Solenthaler
ID: 38721087
Thanks a lot for your post. Yet the whole project - a few php programs with embedded html-code and JavaScripts - is called via wrapper. Because of the weak connection to the Joomla Session and User-DB i decided to put the whole bunch of code into an own module. But i don't know how to use the JHTML::selectionlist..... Need a simple example, like below but with the necessary HTML Part:
------------------------------------------------------------------------
## A default value -- this will be the selected item in the dropdown ##
  $default = 2;
 
  ## An array of $key=>$value pairs ##
  $months = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr');
 
  ## Initialize array to store dropdown options ##
  $options = array();
 
  foreach($months as $key=>$value) :
    ## Create $value ##
    $options[] = JHTML::_('select.option', $key, $value);
  endforeach;
 
  ## Create <select name="month" class="inputbox"></select> ##
  $dropdown = JHTML::_('select.genericlist', $options, 'month', 'class="inputbox"', 'value', 'text', $default);
 
  ## Output created <select> list ##
  echo '</br>'.$dropdown;
---------------------------------------------------------------------------------------------------------
How can i get the result of the selected value - (similar to the $_GET and $_POST?
0
 
LVL 11

Accepted Solution

by:
mcnute earned 500 total points
ID: 38721106
According to the joomla documentation something like that in Joomla 2.5 will do:

Initialize jinput:
$jinput = JFactory::getApplication()->input;

Open in new window


Get value of your select box:
$foo = $jinput->get('month');

Open in new window


Jommla Docs for Jinput
0
 

Author Closing Comment

by:Solenthaler
ID: 38814766
Thanks a lot.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress Security 29 71
ajax to record click 3 24
How do use '  ' within this code? 4 24
Why can I INSERT a DATETIME record into mysql but I can't UPDATE it? 15 32
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question