I’m looking into a way to separate out the pieces of an address to then be entered into a single line application called Matukio events on a Joomla site. The idea is to use Jquery and javascript to take other separate fields to then be entered into the single address field. Here is an image of the database
Here are the fields on the front end that I’m filling with the address from the multiple fields
here are the multiple fields
So the stuff entered into the multiple fields would be entered into the single field after we click on the submit `button.
`class plgSystemEventLocation extends JPlugin
{
var $params = null;
/**
* Method is called by index.php and administrator/index.php
*
* @access public
*/
public function onAfterDispatch()
{
$app = JFactory::getApplication();
if($app->getName() == ‘administrator’) {
//return true;
}
$option = JRequest::getVar(‘option’);
$view = JRequest::getVar(‘view’);
$task = JRequest::getVar(‘task’);
$layout = JRequest::getVar(‘layout’);
$doc = JFactory::getDocument();
if ($option == ‘com_matukio’ && $view == ‘submit’)
{
$cssCode = ”;
$doc->addStyleDeclaration($cssCode);
$jsCode = ‘var jQuery = jQuery.noConflict();
jQuery(document).ready(function($) {
jQuery(window).load(function() {
jQuery(“#btnFinish”).click(function(){
var addressline = jQuery(“#jform_customfields_address”).val();
var city = jQuery(“#jform_customfields_city”).val();
var state = jQuery(“#jform_customfields_state”).val();
var zip = jQuery(“#jform_customfields_zipcode”).val();
var com_addr = addressline+”, “+city+” “+state+” “+zip;
jQuery(“#place, #gmaploc”).val(com_addr);
jQuery(“#gmaploc”).keyup();
//return false;
});
});
});’;
$doc->addScriptDeclaration($jsCode);
}
return true;
}
}`
I will be the first to admit that I have limited knowledge of what the issue is but wanted to be sure that maybe I wasn’t missing something in the code.
Thanks,