Hello and thank you for your time!
I have an external database on the same SQL server as Joomla! database, and my website users should be able to search this database. Take a look at the old website:
http://www.masoc.lv/index.php?id=27&lang=2
Something like the form in the link above should be made in this new, empty Joomla! site:
http://www.masoc.lv/masoc
Is it possible to do such a thing using ChronoForms? Also, as far as I know, that database has seperate fields for three languages, is it possible to display different fields according to the language selected by Joomfish?
Thanks, Janis
PS Is PHP 5 required for using ChronoForms?
PPS Is extensive PHP/MySQL knowledge needed to pull this off?
I have an external database on the same SQL server as Joomla! database, and my website users should be able to search this database. Take a look at the old website:
http://www.masoc.lv/index.php?id=27&lang=2
Something like the form in the link above should be made in this new, empty Joomla! site:
http://www.masoc.lv/masoc
Is it possible to do such a thing using ChronoForms? Also, as far as I know, that database has seperate fields for three languages, is it possible to display different fields according to the language selected by Joomfish?
Thanks, Janis
PS Is PHP 5 required for using ChronoForms?
PPS Is extensive PHP/MySQL knowledge needed to pull this off?
Hi Janis,
It's definitely possible. Max will give you a better answer but it seems to me that ChronoConnectivity might be a better tool for this (or possibly Logos Query Manager).
PHP5 is not necessary for Joomla or ChronoForms (though it may be for future Joomla versions so upgrading is a *good thing*).
You will need some basic MySQL & PHP & Joomal knowledge to do this with the Chrono products (possibly less with the Logos tool).
Bob
It's definitely possible. Max will give you a better answer but it seems to me that ChronoConnectivity might be a better tool for this (or possibly Logos Query Manager).
PHP5 is not necessary for Joomla or ChronoForms (though it may be for future Joomla versions so upgrading is a *good thing*).
You will need some basic MySQL & PHP & Joomal knowledge to do this with the Chrono products (possibly less with the Logos tool).
Bob
Hi Janis,
As Bob mentioned ChronoConnectivity may be a good solution here but the search function is not built in the core yet, no way to connect to an external database yet too, you must use tables inside the Joomla database, so you can do this in Chronoforms but will do some PHP coding of course!
regards
Max
As Bob mentioned ChronoConnectivity may be a good solution here but the search function is not built in the core yet, no way to connect to an external database yet too, you must use tables inside the Joomla database, so you can do this in Chronoforms but will do some PHP coding of course!
regards
Max
Hello!
Let me thank you for your swift answers!š I will try using Chronoforms to achieve the task then. I'm pretty sure more questions will arise in the process, so you will probably hear from me soon!
Cheers,
Janis
Let me thank you for your swift answers!š I will try using Chronoforms to achieve the task then. I'm pretty sure more questions will arise in the process, so you will probably hear from me soon!
Cheers,
Janis
Hello!
So I have started working on my problem deeper. By now I have the same search that was in the old site succesfully implemented in the new one. Also I modified the code so that it recognizes Joomfish language switch. So basically I copied the code from the old page in to the form code in chronoforms and modified the existing language switch so that it recognises the joomfish.
So far, so good, except the fact that the search does not work properly yetš
Please see the progress here:
http://www.masoc.lv/masoc/index.php?option=com_chronocontact&Itemid=3&lang=en
And the old search here:
http://masoc.lv/index.php?id=27&lang=2
As you play around with both searches you will notice that when you press for example "District" in the old search, a new table opens up and something happens, also if you press "Get all companies", all companies are being displayed. But in the new one when you press "District", nothing happens, the same with "Get all companies".
The thing is that the code that I pasted for use in the chronoforms from the old site in the old site was used as an included php-file in the main index.php. Something like: "If database=1, then include: xxx.php", so now I am using that xxx.php. My best guess is that the javascript is not being executed. I don't know why though, I think something was included or done in the main file that includes javascript globally and now I am missing that.
So the code is here
I would be very thankful if someone would look into it and point me to the thing I am missing!š
So I have started working on my problem deeper. By now I have the same search that was in the old site succesfully implemented in the new one. Also I modified the code so that it recognizes Joomfish language switch. So basically I copied the code from the old page in to the form code in chronoforms and modified the existing language switch so that it recognises the joomfish.
So far, so good, except the fact that the search does not work properly yetš
Please see the progress here:
http://www.masoc.lv/masoc/index.php?option=com_chronocontact&Itemid=3&lang=en
And the old search here:
http://masoc.lv/index.php?id=27&lang=2
As you play around with both searches you will notice that when you press for example "District" in the old search, a new table opens up and something happens, also if you press "Get all companies", all companies are being displayed. But in the new one when you press "District", nothing happens, the same with "Get all companies".
The thing is that the code that I pasted for use in the chronoforms from the old site in the old site was used as an included php-file in the main index.php. Something like: "If database=1, then include: xxx.php", so now I am using that xxx.php. My best guess is that the javascript is not being executed. I don't know why though, I think something was included or done in the main file that includes javascript globally and now I am missing that.
So the code is here
<link type="text/css" rel="STYLESHEET" href="classic.css">
<?php
include_once("inc/config.inc.php");
include_once("inc/nos.inc");
$charset = 'utf-8';
$db = mysql_pconnect($CONFIG['HOST_NAME_DB'], $CONFIG['DB_USERNAME_DB'], $CONFIG['DB_PASSWORD_DB']);
mysql_select_db($CONFIG['DATABASE_NAME_DB'], $db);
mysql_query( "SET NAMES 'utf8'", $db);
$_SESSION["no_process"] = "0";
// --------------------------------------------------------------------
$query = 'SELECT '
. ' UZNEMUMU_RAKSTURLIELUMI.ID, ';
if ($_GET['lang']==1)
$query = $query.' UZNEMUMU_RAKSTURLIELUMI.NOSAUKUMS_LV NOS, ';
else
if ($_GET['lang']==2)
$query = $query.' UZNEMUMU_RAKSTURLIELUMI.NOSAUKUMS_EN NOS, ';
else
$query = $query.' UZNEMUMU_RAKSTURLIELUMI.NOSAUKUMS_RU NOS, ';
$query = $query.' DATU_TIPI.IEKS_NOS '
. ' FROM UZNEMUMU_RAKSTURLIELUMI, DATU_TIPI'
. ' WHERE DATU_TIPI.ID=UZNEMUMU_RAKSTURLIELUMI.ID_DATU_TIPI'
. ' AND UZNEMUMU_RAKSTURLIELUMI.ID_UZNEMUMU_VEIDI=1'
. ' AND IR_MEKLETAJS=1'
. " AND DATU_TIPI.IEKS_NOS IN ('NUMBER','MONEY')"
. ' ORDER BY UZNEMUMU_RAKSTURLIELUMI.KARTAS_NR';
$result = mysql_query($query, $db) or die(mysql_error());
$num_results = mysql_num_rows($result);
$results = array();
$i=0;
?>
</BR>
<center><b><?
if ($_GET["lang"]==1)
echo iconv('windows-1257','utf-8','IEVADIET ATLASES KRITÄRIJUS');
else
if ($_GET["lang"]==2)
echo iconv('windows-1257','utf-8','ENTER SEARCH PARAMETERS');
else
echo $atl_krit_kriev;
?></b></center> </BR>
<form name="viewer" method="POST">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<table width="560" cellspacing="0" cellpadding="2">
<tr>
<td align="right">
<?
if ($_GET["lang"]==1)
echo iconv('windows-1257','utf-8','UzÅÄmums:');
else
if ($_GET["lang"]==2)
echo iconv('windows-1257','utf-8','Company name:');
else
echo $uzn_nos_kriev;
?>
</td>
<td width="<? if ($_GET["lang"]==1) echo 380; else if ($_GET["lang"]==2) echo 421; else echo 406; ?>">
<?
$query_nos = 'SELECT '
. ' UZNEMUMI.ID, VERTIBA_LV'
. ' FROM UZNEMUMI, A_UZN_RAKST, UZNEMUMU_RAKSTURLIELUMI'
. ' WHERE UZNEMUMI.ID_UZNEMUMU_VEIDI=1'
. ' AND AKTIVS=1'
. ' AND UZNEMUMI.ID=A_UZN_RAKST.ID_UZNEMUMI'
. ' AND UZNEMUMU_RAKSTURLIELUMI.ID=A_UZN_RAKST.ID_RAKSTURLIELUMI'
. ' AND UZN_NOSAUKUMS=1'
. ' ORDER by VERTIBA_LV';
$result_nos = mysql_query($query_nos, $db) or die(mysql_error());
?>
<select style="width:362px" name="uzn_nos" onchange="atlasit_vienu(this.value)">
<option value="" > <?
if ($_GET["lang"]==1)
echo iconv('windows-1257','utf-8','IzvÄlies uzÅÄmumu');
else
if ($_GET["lang"]==2)
echo iconv('windows-1257','utf-8','Select company');
else
echo $izv_uzn_kriev;
?></option>
<?
while ($r_nos=mysql_fetch_array($result_nos)) {
?>
<option value="<? echo $r_nos['ID']; ?>" > <? echo $r_nos['VERTIBA_LV']; ?> </option>
<?
}
?>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script type="text/javascript">
var interv = [];
var interv_id = [];
var interv_no = [];
var interv_lidz = [];
</script>
<table>
<?
$z = array();
$z_skaits=0;
while ($r=mysql_fetch_array($result)) {
$z_skaits++;
$z[$z_skaits] = $r['ID'];
$z_skaits++;
$z[$z_skaits] = $r['ID']."no";
$z_skaits++;
$z[$z_skaits] = $r['ID']."lidz";
?>
<tr>
<td align="right">
<?
echo $r['NOS'].":";
?>
</td>
<td>
<?
$query_int = 'SELECT '
. ' ID, '
. ' NO, LIDZ'
. ' FROM INTERVALI'
. ' WHERE ID_RAKSTURLIELUMI='.$r['ID']
. ' ORDER BY NO, LIDZ';
$result_int = mysql_query($query_int, $db) or die(mysql_error());
?>
<script type="text/javascript">
interv.push(<? echo $r['ID']; ?>);
</script>
<select style="width:175px" name="<? echo $r['ID']; ?>" onchange="interv_id[this.name] = this.value;">
<option value="" > <?
if ($_GET["lang"]==1)
echo iconv('windows-1257','utf-8','IzvÄlies intervÄlu');
else
if ($_GET["lang"]==2)
echo iconv('windows-1257','utf-8','Select interval');
else
echo $izv_int_kriev;
?></option>
<?
while ($r_int=mysql_fetch_array($result_int)) {
?>
<option value="<? echo $r_int['ID']; ?>" > <? echo number_format($r_int['NO'], 0, '.', ' ')."-".number_format($r_int['LIDZ'], 0, '.', ' '); ?> </option>
<?
}
?>
</select>
</td>
<td>
<?
if ($_GET["lang"]==1)
echo iconv('windows-1257','utf-8','DefinÄ intervÄlu:');
else
if ($_GET["lang"]==2)
echo iconv('windows-1257','utf-8','Specify interval:');
else
echo $nor_int_kriev;
?>
<?
if ($_GET["lang"]==1)
echo $msg3_lv;
else
if ($_GET["lang"]==2)
echo $msg3_en;
else
echo $msg3_ru;
?>
<input type="text" size="10" name="<? echo $r['ID']."no"; ?>" onchange="interv_no[this.name.substr(0,this.name.length-2)] = this.value; ">
<?
if ($_GET["lang"]==1)
echo $msg4_lv;
else
if ($_GET["lang"]==2)
echo $msg4_en;
else
echo $msg4_ru;
?>
<input type="text" size="10" name="<? echo $r['ID']."lidz"; ?>" onchange="interv_lidz[this.name.substr(0,this.name.length-4)] = this.value; ">
</td>
</tr>
<?
}
?>
</table>
<?
$query = 'SELECT '
. ' UZNEMUMU_RAKSTURLIELUMI.ID, ';
if ($_GET['lang']==1)
$query = $query.' UZNEMUMU_RAKSTURLIELUMI.NOSAUKUMS_LV NOS, ';
else
if ($_GET['lang']==2)
$query = $query.' UZNEMUMU_RAKSTURLIELUMI.NOSAUKUMS_EN NOS, ';
else
$query = $query.' UZNEMUMU_RAKSTURLIELUMI.NOSAUKUMS_RU NOS, ';
$query = $query.' DATU_TIPI.IEKS_NOS '
. ' FROM UZNEMUMU_RAKSTURLIELUMI, DATU_TIPI'
. ' WHERE DATU_TIPI.ID=UZNEMUMU_RAKSTURLIELUMI.ID_DATU_TIPI'
. ' AND UZNEMUMU_RAKSTURLIELUMI.ID_UZNEMUMU_VEIDI=1'
. ' AND IR_MEKLETAJS=1'
. " AND DATU_TIPI.IEKS_NOS IN ('TEXT_KLAS','TEXT_KLAS_SAR', 'TEXT_KLAS_SAR_2')"
. ' ORDER BY UZNEMUMU_RAKSTURLIELUMI.KARTAS_NR';
$result = mysql_query($query, $db) or die(mysql_error());
$num_results = mysql_num_rows($result);
$results = array();
$i=0;
?>
<table width=740>
<tr>
<td valign="top" width="380">
<div style="width:370px;border=1px inset black">
<script type="text/javascript">
var lielie = [];
var izv_id = [];
var izv_nos = [];
var izv_id2 = [];
var izv_nos2 = [];
</script>
<?
while ($r=mysql_fetch_array($result)) {
?>
<INPUT TYPE=RADIO onclick="changeView()" NAME="view1" VALUE="<? echo $r['ID']; ?>"><? echo $r['NOS']; ?><BR>
<script type="text/javascript">
lielie["<? echo $r['ID']; ?>"] = "<? echo $r['NOS']; ?>";
</script>
<?
}
?>
</select>
</div>
<br>
<div id="atl">
</div>
</td>
<td valign="top">
<div id="klas1" style="width:370px;border=1px inset black;display:none">
</div>
<br>
<div id="klas2" style="width:370px;border=1px inset black;display:none">
</div>
</td>
</table>
<hr>
<CENTER>
<? if ($_GET['lang']==1){ ?>
<input type="button" value="<? echo iconv('windows-1257','utf-8','AtlasÄ«t pÄc kritÄrijiem') ?>" onclick="atlasit_pec_krit()">Ā
<input type="button" value="<? echo iconv('windows-1257','utf-8','AtlasÄ«t visus uzÅÄmumus') ?>" onclick="atlasit_visus()">Ā
<input type="button" value="<? echo iconv('windows-1257','utf-8','DzÄst kritÄrijus') ?>" onclick="dzest()">
<? } else if ($_GET['lang']==2){ ?>
<input type="button" value="<? echo iconv('windows-1257','utf-8','Search by parameters') ?>" onclick="atlasit_pec_krit()">Ā
<input type="button" value="<? echo iconv('windows-1257','utf-8','Get all companies') ?>" onclick="atlasit_visus()">Ā
<input type="button" value="<? echo iconv('windows-1257','utf-8','Clear parameters') ?>" onclick="dzest()">
<? } else { ?>
<input type="button" value="<? echo $poga1 ?>" onclick="atlasit_pec_krit()">Ā
<input type="button" value="<? echo $poga2 ?>" onclick="atlasit_visus()">Ā
<input type="button" value="<? echo $poga3 ?>" onclick="dzest()">
<? } ?>
</CENTER>
<div id="loading" style="display:none"><img src="images/loading.gif"><b>
<? if ($_GET['lang']==1)echo $msg1_lv ?>
<? if ($_GET['lang']==2)echo $msg1_en ?>
<? if ($_GET['lang']==3)echo $msg1_ru ?>
</b></div>
<div id="rez">
</div>
</form>
<script type="text/javascript">
function atlasit_pec_krit(){
document.getElementById("klas1").innerHTML = '';
document.getElementById("klas2").innerHTML = '';
document.getElementById("rez").innerHTML = "";
document.getElementById("loading").style.display= 'block';
var temp=[];
for (t in izv_id){
temp.push(parseInt(t));
}
var temp2=[];
for (t in izv_id2){
temp2.push(parseInt(t));
}
var no=[];
var lidz=[];
var idi=[];
for (g in interv){
idi.push(parseInt(interv_id[interv[g]]));
no.push(parseInt(interv_no[interv[g]]));
lidz.push(parseInt(interv_lidz[interv[g]]));
}
// ajaxObj.debug=1;
ajaxObj.call("action=getPecKrit&lang="+<? echo $_GET["lang"]; ?> +"&i="+JSON.stringify(interv)+ "&i_id="+JSON.stringify(idi)+ "&i_no="+JSON.stringify(no)+ "&i_lidz="+JSON.stringify(lidz)+ "&izv_id="+JSON.stringify(temp)+ "&izv_id2="+JSON.stringify(temp2), loadVisas);
}
function atlasit_visus(){
document.getElementById("klas1").innerHTML = '';
document.getElementById("klas2").innerHTML = '';
document.getElementById("loading").style.display= 'block';
document.getElementById("rez").innerHTML = "";
// ajaxObj.debug=1;
ajaxObj.call("action=getVisas&lang="+<? echo $_GET["lang"]; ?> +"", loadVisas);
}
function atlasit_vienu(a){
document.getElementById("loading").style.display= 'block';
document.getElementById("rez").innerHTML = "";
// ajaxObj.debug=1;
if (a=="")
a =-1;
ajaxObj.call("action=getVisas&lang="+<? echo $_GET["lang"]; ?> +"&id="+a, loadVisas);
}
function loadVisas(resp){
document.getElementById("loading").style.display= 'none';
a = "<HR>";
for (u in resp){
a = a + resp[u][0]+". ";
a = a + "<img src='getdata.php?id="+resp[u][1]+"'/>"+"<BR>";
k = 0;
a = a + "<table border=0><tr><td width='370' valign='top'>";
for (r in resp[u][3]){
k = k+1;
if (k==16){
a = a +"</td><td width='370' valign='top'>";
}
b = "";
t = 0;
for (r2 in resp[u][3][r][1]){
if ((resp[u][3][r][1].length>1) && (t<resp[u][3][r][1].length-1) ){
if (resp[u][3][r][1][r2]!=null)
b = b + resp[u][3][r][1][r2] + ", ";
}
else
{
if (resp[u][3][r][1][r2]!=null)
b = b + resp[u][3][r][1][r2] + "<br>";
}
t = t+1;
}
if (b!=""){
if (k!=1){
if (t>1){
a = a + "<B> "+resp[u][3][r][0] + "</B>";
}
else
{
a = a + "<B>"+resp[u][3][r][0] + " </B>";
}
}
if (k==1){
a = a + "<B><BIG>" + b + "</BIG></B>";
}
else
a = a + b;
}
}
a = a + "<br>";
a = a + "</td></tr></table>";
}
if (a=="<HR>"){
<? if ($_GET['lang']==1){ ?>
a = a + "<? echo $msg2_lv ?>";
<? } else if ($_GET['lang']==2){ ?>
a = a + "<? echo $msg2_en ?>";
<? } else if ($_GET['lang']==3){ ?>
a = a + "<? echo $msg2_ru ?>";
<? } ?>
}
document.getElementById("rez").innerHTML = a;
}
function dzest(){
izv_id = [];
izv_nos = [];
izv_id2= [];
izv_nos2 = [];
document.getElementById("atl").innerHTML = '';
document.getElementById("klas1").innerHTML = '';
document.getElementById("klas2").innerHTML = '';
document.getElementById("uzn_nos").value = '';
<? for ($i=1; $i<= $z_skaits; $i++){ ?>
document.getElementById("<? echo $z[$i] ?>").value = '';
<? } ?>
interv_id = [];
interv_no = [];
interv_lidz = [];
}
function loadR1(resp)
{
if(resp) {
document.getElementById("klas1").style.display= 'block';
document.getElementById("klas2").style.display= 'none';
document.getElementById("klas1").innerHTML = resp;
document.getElementById("klas2").innerHTML = '';
} else {
document.getElementById("klas1").style.display= 'none';
document.getElementById("klas2").style.display= 'none';
}
}
function changeView()
{
document.getElementById("klas1").innerHTML = '';
document.getElementById("klas2").innerHTML = '';
box1 = document.viewer.view1;
for (counter = 0; counter < box1.length; counter++)
{
if (box1[counter].checked)
band = box1[counter].value;
}
ajaxObj.method="GET";
var temp=[];
for (t in izv_id){
temp.push(parseInt(t));
}
var temp2=[];
for (t in izv_id2){
temp2.push(parseInt(t));
}
// ajaxObj.debug=1;
ajaxObj.call("action=getR1&lang="+<? echo $_GET["lang"]; ?> +"&band="+encodeURIComponent(band)+"&izv_id="+JSON.stringify(temp)+"&izv_id2="+JSON.stringify(temp2), loadR1);
}
function changeView2()
{
document.getElementById("klas2").innerHTML = '';
box1 = document.viewer.view2;
for (counter = 0; counter < box1.length; counter++)
{
if (box1[counter].checked)
band = box1[counter].value;
}
ajaxObj.method="GET";
// ajaxObj.debug=1;
var temp=[];
for (t in izv_id2){
temp.push(parseInt(t));
}
ajaxObj.call("action=getR2&lang="+<? echo $_GET["lang"]; ?> +"&band="+encodeURIComponent(band)+"&izv_id2="+JSON.stringify(temp), loadR2);
}
function loadR2(resp)
{
if(resp) {
document.getElementById("klas2").style.display= 'block';
document.getElementById("klas2").innerHTML = resp;
// location.hash = 'tips';
} else {
document.getElementById("klas2").style.display= 'none';
// document.getElementById("loading").style.display= 'none';
}
}
function click2(b, c, d){
var vai_ir = izv_id[b];
if (vai_ir==null){
box = document.viewer.view1;
for (counter = 0; counter < box.length; counter++)
{
if (box[counter].checked)
band = box[counter].value;
}
izv_id[b] = band;
izv_nos[b] = d;
}
else{
delete izv_id[b];
delete izv_nos[b];
}
var a = "";
var t_a = "";
var tt_a = "";
for (var liel in lielie){
t_a = "<b>" +lielie[liel] + "</B><BR>";
tt_a = "";
for (var ids in izv_id){
if (izv_id[ids]==liel){
tt_a = tt_a + "<li>" + izv_nos[ids] + "</li>";
}
}
for (var ids in izv_id2){
if (izv_id2[ids]==liel){
tt_a = tt_a + "<li>" + izv_nos2[ids] + "</li>";
}
}
if (tt_a!=""){
a = a + t_a + tt_a;
}
}
document.getElementById("atl").innerHTML = a;
}
function click4(b, c, d){
var vai_ir = izv_id2[b];
if (vai_ir==null){
box = document.viewer.view1;
for (counter = 0; counter < box.length; counter++)
{
if (box[counter].checked)
band = box[counter].value;
}
izv_id2[b] = band;
izv_nos2[b] = d;
}
else{
delete izv_id2[b];
delete izv_nos2[b];
}
var a = "";
var t_a = "";
var tt_a = "";
for (var liel in lielie){
t_a = "<b>" +lielie[liel] + "</B><BR>";
tt_a = "";
for (var ids in izv_id){
if (izv_id[ids]==liel){
tt_a = tt_a + "<li>" + izv_nos[ids] + "</li>";
}
}
for (var ids in izv_id2){
if (izv_id2[ids]==liel){
tt_a = tt_a + "<li>" + izv_nos2[ids] + "</li>";
}
}
if (tt_a!=""){
a = a + t_a + tt_a;
}
}
document.getElementById("atl").innerHTML = a;
}
function click3(b, c, d){
var vai_ir = izv_id2[b];
if (vai_ir==null){
box = document.viewer.view1;
for (counter = 0; counter < box.length; counter++)
{
if (box[counter].checked)
band = box[counter].value;
}
izv_id2[b] = band;
izv_nos2[b] = d;
}
else{
delete izv_id2[b];
delete izv_nos2[b];
}
var a = "";
var t_a = "";
var tt_a = "";
for (var liel in lielie){
t_a = "<b>" +lielie[liel] + "</B><BR>";
tt_a = "";
for (var ids in izv_id){
if (izv_id[ids]==liel){
tt_a = tt_a + "<li>" + izv_nos[ids] + "</li>";
}
}
for (var ids in izv_id2){
if (izv_id2[ids]==liel){
tt_a = tt_a + "<li>" + izv_nos2[ids] + "</li>";
}
}
if (tt_a!=""){
a = a + t_a + tt_a;
}
}
document.getElementById("atl").innerHTML = a;
}
</script>
I would be very thankful if someone would look into it and point me to the thing I am missing!š
Hi Janis,
Your old form loads a big (600 lines) JavaScript file called mybic.js that implements the AJAX interface. That file is isn't being loaded in the new site and there doesn't appear to be any substitute.
First thing to try is simply to add that file in the new site.
Bob
Your old form loads a big (600 lines) JavaScript file called mybic.js that implements the AJAX interface. That file is isn't being loaded in the new site and there doesn't appear to be any substitute.
First thing to try is simply to add that file in the new site.
<?php
$doc =& JFactory::getDocument();
$doc->addScript('http://masoc.lv/mybic.js');
?>
NB Not tested and may need debuggingBob
Nothing changes...
I found this code in the old index.php
It looks like the one that enables mybic.js, as well as the other. I tried to copy this code in my form code, nothing changed though. Also, my form code in chronoforms is in the form code window called (Form code (HTML+PHP)), below is (Form code - javascript) which is empty. Could it be that the script is not being executed because it is in the code window where HTML+PHP is required?
I found this code in the old index.php
<script type="text/javascript" src="mybic.js"></script>
<script type="text/javascript">
var ajaxObj = new XMLHTTP("mybic_server.php");
</script>
It looks like the one that enables mybic.js, as well as the other. I tried to copy this code in my form code, nothing changed though. Also, my form code in chronoforms is in the form code window called (Form code (HTML+PHP)), below is (Form code - javascript) which is empty. Could it be that the script is not being executed because it is in the code window where HTML+PHP is required?
Update!
So I figured out that I have to copy something from the old index.php to the form code in order for it to execute scripts.
I thought this could be the code needed:
So I made an experiment I created a file which is composed from this header and the old form code.
You can see it here:
http://masoc.lv/metal_db3.php
You will notice that when selecting some name from the upper box it gives a list below, so that form partly works. (I think that it is not working correctly because of the old language switch. In some places in the code there is "if language 1 then, language 2 then, else" but in some places "if language 1 then, if language 2 then, if language 3 then" the russian is either "else" in some places or "language 3" in other. Because the old language switch is not present when accessing the form code seperately it displays russian and something may not work) But that is a bit offtopic.
The thing is, if I paste the same header into the Form HTML code nothing happens. It does not even give the full list that the metal_db3.php does. I am a bit confused.
Edit:
Forgot to mention that I have copied files mybic.js and mybic_server.php into the com_chronocontact directory so the code should be able to locate them.
So I figured out that I have to copy something from the old index.php to the form code in order for it to execute scripts.
I thought this could be the code needed:
<html>
<head>
<title><? echo iconv('windows-1257','utf-8','MaŔīnbÅ«ves un MetÄlapstrÄdes RÅ«pniecÄ«bas UzÅÄmÄju asociÄcija');?></title>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="mybic.js"></script>
<script type="text/javascript">
var ajaxObj = new XMLHTTP("mybic_server.php");
</script>
</head>
So I made an experiment I created a file which is composed from this header and the old form code.
You can see it here:
http://masoc.lv/metal_db3.php
You will notice that when selecting some name from the upper box it gives a list below, so that form partly works. (I think that it is not working correctly because of the old language switch. In some places in the code there is "if language 1 then, language 2 then, else" but in some places "if language 1 then, if language 2 then, if language 3 then" the russian is either "else" in some places or "language 3" in other. Because the old language switch is not present when accessing the form code seperately it displays russian and something may not work) But that is a bit offtopic.
The thing is, if I paste the same header into the Form HTML code nothing happens. It does not even give the full list that the metal_db3.php does. I am a bit confused.
Edit:
Forgot to mention that I have copied files mybic.js and mybic_server.php into the com_chronocontact directory so the code should be able to locate them.
Hi Janis,
That helps - looks as though we need to second snippet in the form html
Bob
That helps - looks as though we need to second snippet in the form html
<?php
$doc =& JFactory::getDocument();
$doc->addScript('http://masoc.lv/mybic.js');
$doc->addScriptDeclaration('var ajaxObj = new XMLHTTP("http://masoc.lv/mybic_server.php");');
?>
This is going to call yet another file called mybic_server.php Note that both this and the js file are on the old site. At some point you'll need to relocate them onto the new one.Bob
Hello!
Tried to add the mentioned code, still no luck.
In the mean time I did yet another experiment. I embedded a link to the modified old php file (the one that gives a list out) in an article using PHPinclude plugin. So basically these two links are using exactly the same php file.
http://masoc.lv/metal_db3.php
http://www.masoc.lv/masoc/index.php?option=com_content&view=article&id=2&Itemid=5&lang=en
As you can see. In the first link when choosing a name in the upper box it gives out a list whereas in the second link (exactly the same file accesed through a Joomla article) nothing happens...
Could this be some global Joomla setting regarding ajax/javascript?
Tried to add the mentioned code, still no luck.
In the mean time I did yet another experiment. I embedded a link to the modified old php file (the one that gives a list out) in an article using PHPinclude plugin. So basically these two links are using exactly the same php file.
http://masoc.lv/metal_db3.php
http://www.masoc.lv/masoc/index.php?option=com_content&view=article&id=2&Itemid=5&lang=en
As you can see. In the first link when choosing a name in the upper box it gives out a list whereas in the second link (exactly the same file accesed through a Joomla article) nothing happens...
Could this be some global Joomla setting regarding ajax/javascript?
Hi Janis,
If you haven't already got it I strongly suggest that you get the Firebug extension for FireFox - it's invaluable for debugging this kind of problem.
Firebug shows three JavaScript errors for the Joomla version - see the image below. The first of these tells you that the ajaxObj is not being initialised. I think this is probably because the full file path isn't there. If you look at my last post you'll see that I suggested some code for this including the full path. I don't knwo if this will work but it is step in the right direction.
Bob
If you haven't already got it I strongly suggest that you get the Firebug extension for FireFox - it's invaluable for debugging this kind of problem.
Firebug shows three JavaScript errors for the Joomla version - see the image below. The first of these tells you that the ajaxObj is not being initialised. I think this is probably because the full file path isn't there. If you look at my last post you'll see that I suggested some code for this including the full path. I don't knwo if this will work but it is step in the right direction.
Bob
Thank you for the hint on Firebug, it is really useful!
I have included the code you mentioned, indeed the error of not loading XMLHTTP is gone now. Also I got rid of one more error. It showed that 'en' is not defined. I figured out that although I replaced the language swich for the one which recognizes joomfish, when making an sql query it still "GETs" a variable "$lang", which from joomfish comes as en, lv, and ru accordingly. So I replaced those abbreviations in joomfish language control panel with needed numbers 1,2,3, and used the old language switch. So far so good only it messed up those language flags...
Closer to the point. You can see the progress here:
http://www.masoc.lv/masoc/index.php?option=com_chronocontact&Itemid=3&lang=2
As you can see when pressing on the "District" it shows an error that some variable "document.viewer" is not defined, I'm not sure why, though, I haven't changed the code actually. And secondly you will notice that when choosing a company from the above box it gives an error that the link "http://www.masoc.lv/masoc/index.php?option=com_chronocontact&Itemid=3&lang=2" is not allowed to load data from: "http://masoc.lv/mybic_server.php"...
Any insights on this?
I have included the code you mentioned, indeed the error of not loading XMLHTTP is gone now. Also I got rid of one more error. It showed that 'en' is not defined. I figured out that although I replaced the language swich for the one which recognizes joomfish, when making an sql query it still "GETs" a variable "$lang", which from joomfish comes as en, lv, and ru accordingly. So I replaced those abbreviations in joomfish language control panel with needed numbers 1,2,3, and used the old language switch. So far so good only it messed up those language flags...
Closer to the point. You can see the progress here:
http://www.masoc.lv/masoc/index.php?option=com_chronocontact&Itemid=3&lang=2
As you can see when pressing on the "District" it shows an error that some variable "document.viewer" is not defined, I'm not sure why, though, I haven't changed the code actually. And secondly you will notice that when choosing a company from the above box it gives an error that the link "http://www.masoc.lv/masoc/index.php?option=com_chronocontact&Itemid=3&lang=2" is not allowed to load data from: "http://masoc.lv/mybic_server.php"...
Any insights on this?
Hi Janis,
In the original page the form name is viewer
The other error is probably a permissions issue; but I don't see the error message and I don't have much idea what is happening.
Bob
In the original page the form name is viewer
<form method="post" name="viewer">
in the new one it is called ChronoContact_database<form id="ChronoContact_database" action="http://www.masoc.lv/masoc/index.php?option=com_chronocontact&task=send&chronoformname=database" method="get" name="ChronoContact_database">
The other error is probably a permissions issue; but I don't see the error message and I don't have much idea what is happening.
Bob
Good morning!
I changed the code so that in every place where "document.viewer" was used is "document.ChronoContact_database" instead, that error is gone for now. The second is still there though.
Here is what I managed to find out. The error firebug gives is: "uncaught exception: Access to restricted URI denied (NS_ERROR_DOM_BAD_URI); this.req.open(this.method, this.full_url, this.async); in mybic.js (line 125)"
As I found in the net this error is given when cross-host request is being made (this is agains some ajax origin rules or something), in order to find where this is defined I followed "this.full_url" in "mybic.js". "this.full_url" is made of "this.server_url + variables", and "this.server_url= server_url;"
So this is where i got lost. What is "server_url". Is it some kind of ajax function that gives out an URL, and how can I change it?
Any insights?
Thanks, Janis.
I changed the code so that in every place where "document.viewer" was used is "document.ChronoContact_database" instead, that error is gone for now. The second is still there though.
Here is what I managed to find out. The error firebug gives is: "uncaught exception: Access to restricted URI denied (NS_ERROR_DOM_BAD_URI); this.req.open(this.method, this.full_url, this.async); in mybic.js (line 125)"
As I found in the net this error is given when cross-host request is being made (this is agains some ajax origin rules or something), in order to find where this is defined I followed "this.full_url" in "mybic.js". "this.full_url" is made of "this.server_url + variables", and "this.server_url= server_url;"
So this is where i got lost. What is "server_url". Is it some kind of ajax function that gives out an URL, and how can I change it?
Any insights?
Thanks, Janis.
Hi Janis,
I imagine that this.server_url is the url of the *current* server - that is wherever the code is being called from. JavaScript has some pretty tight rules to prevent cross-server activities - just so that a script *can't* run potentially malicious code from somewhere else in your browser. I guess that's what's happening here.
Bob
I imagine that this.server_url is the url of the *current* server - that is wherever the code is being called from. JavaScript has some pretty tight rules to prevent cross-server activities - just so that a script *can't* run potentially malicious code from somewhere else in your browser. I guess that's what's happening here.
Bob
Hello again!
First of all let me thank you for your support, I understand that this is no longer a chronoforms specific comunication but more general php and javascript. Anyways thank you for your help.
This is how far I have got:
http://masoc.lv/masoc/index.php?option=com_chronocontact&Itemid=3&lang=2
The problem about security and hosts still persist. The thing is if a script is accessed from (http://www.masoc.lv) it won't work if it's accessed from (http://masoc.lv) (notice the "www") it works, so it doesn't understand "www.masoc.lv" and "masoc.lv" as a same host... Any ideas how could I fix this?
Further if a form is accessed through "masoc.lv" as the link above the searcher partly works. You will notice that by pressing on "District" district list opens up they can be selected, marvelous. Although if pressing "search by criteria" it shows that nothing can be found. And firebug shows that there is problem in SQL syntax. " You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near ',,,,,,,,,,,,,)' at line 1"
I think because in POST it shows that it sends something like this "izv_id
[105,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]" while in the original form it is only "izv_id [105]" I don't know why those "null" are there... But I think this is the problem for this issue.
And lastly if choosing some name from "company name" (most above field) It gives out a company only it gives a lot a junk code after each bit of needed information. (I noticed that the junk code is always the same).
Do you have any ideas about anything of this?
Thank you!
Janis
First of all let me thank you for your support, I understand that this is no longer a chronoforms specific comunication but more general php and javascript. Anyways thank you for your help.
This is how far I have got:
http://masoc.lv/masoc/index.php?option=com_chronocontact&Itemid=3&lang=2
The problem about security and hosts still persist. The thing is if a script is accessed from (http://www.masoc.lv) it won't work if it's accessed from (http://masoc.lv) (notice the "www") it works, so it doesn't understand "www.masoc.lv" and "masoc.lv" as a same host... Any ideas how could I fix this?
Further if a form is accessed through "masoc.lv" as the link above the searcher partly works. You will notice that by pressing on "District" district list opens up they can be selected, marvelous. Although if pressing "search by criteria" it shows that nothing can be found. And firebug shows that there is problem in SQL syntax. " You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near ',,,,,,,,,,,,,)' at line 1"
I think because in POST it shows that it sends something like this "izv_id
[105,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]" while in the original form it is only "izv_id [105]" I don't know why those "null" are there... But I think this is the problem for this issue.
And lastly if choosing some name from "company name" (most above field) It gives out a company only it gives a lot a junk code after each bit of needed information. (I noticed that the junk code is always the same).
Do you have any ideas about anything of this?
Thank you!
Janis
Hello! If you tried to access the form yesterday, it did not work because I had "SEO optimised URL's" switched on in the Joomla Global configuration settings. I noticed that it gives out an error only today.
Are there any ideas about issues mentioned in the previous post?
Thanks
Janis
Are there any ideas about issues mentioned in the previous post?
Thanks
Janis
Update!
I managed to get rid of the security error! In the form code script I added (document.domain="masoc.lv"; ). Now the script works both - when accessed through masoc.lv/somethin URL as well as when accessed from <!-- w --><a class="postlink" href="http://www.masoc.lv">www.masoc.lv</a><!-- w --> URLš I'm happy about this.
Now the other two errors still persist.
I managed to get rid of the security error! In the form code script I added (document.domain="masoc.lv"; ). Now the script works both - when accessed through masoc.lv/somethin URL as well as when accessed from <!-- w --><a class="postlink" href="http://www.masoc.lv">www.masoc.lv</a><!-- w --> URLš I'm happy about this.
Now the other two errors still persist.
Hi Janis,
your SQL errors are hard to fix without seeing your PHP code and the table structure..etc and also try to "echo" the error and don't use an alert box to show it!
Regards
Max
your SQL errors are hard to fix without seeing your PHP code and the table structure..etc and also try to "echo" the error and don't use an alert box to show it!
Regards
Max
Hello!
I have succesfully implemented the form in the new site. At the final solution I didn't use chronoforms at all. I made the searcher as a seperate page (outside of Joomla) and then implemented it using the "wrapper".
Anyways let me thank you for your patience and help it was really valuable. Without the lessons learned through trying to do this using Chronoforms I Wouldn't be able to pull this solution off.
You can see the result here:
http://www.masoc.lv/masoc/index.php?option=com_wrapper&view=wrapper&Itemid=15&lang=1
Yes, there are seperate language switch for the form, but that's basically the only flaw, I'm pretty satisfyed with this result.
I'm not discarding Chronoforms though, I think that a form (or maybe two or three forms) will be needed later in order to give an ability to users to post some information in the site. When the time comes to make this - I'm sure I will use some of Chrono tools!
Again, thanks for your help!
Janis.
I have succesfully implemented the form in the new site. At the final solution I didn't use chronoforms at all. I made the searcher as a seperate page (outside of Joomla) and then implemented it using the "wrapper".
Anyways let me thank you for your patience and help it was really valuable. Without the lessons learned through trying to do this using Chronoforms I Wouldn't be able to pull this solution off.
You can see the result here:
http://www.masoc.lv/masoc/index.php?option=com_wrapper&view=wrapper&Itemid=15&lang=1
Yes, there are seperate language switch for the form, but that's basically the only flaw, I'm pretty satisfyed with this result.
I'm not discarding Chronoforms though, I think that a form (or maybe two or three forms) will be needed later in order to give an ability to users to post some information in the site. When the time comes to make this - I'm sure I will use some of Chrono tools!
Again, thanks for your help!
Janis.
Hi Janis,
No problems, glad you did it and you learned how its done, now the next time you are trying to use Chrono tools you will have more options and abilitiesš
regards,
Max
No problems, glad you did it and you learned how its done, now the next time you are trying to use Chrono tools you will have more options and abilitiesš
regards,
Max
This topic is locked and no more replies can be posted.