Onsubmit code debugging....

mathurva 22 Jun, 2009
Just came on board Joomla(1.5) and Chronoforms(3.1). A real newbie!

We have created some forms for adding data to our mySql tables. We want to write code for making an Sql query to get the filtered table data based on the user choice in a CSV format file. We saw the use of redirection for writing a "Thank You" on the page by redirection of URL.

We were trying to write some PHP code for OnSubmit; but even "echo" does not throw out the desired debugging data so that we can constructively write the small routine that we need for our purpose.

We need help in getting over this ASAP, so that we do not go and look for a better Form management module.

Thanks for helping!
Max_admin 22 Jun, 2009
Hi mathurva,

if you have a redirect then it will redirect before you can see the output from the onsubmit boxes code!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mathurva 24 Jun, 2009

Hi mathurva,

if you have a redirect then it will redirect before you can see the output from the onsubmit boxes code!

Cheers
Max



Hi Max,

We have a very simple straight forward requirement of retrieving the data from a Table stored by us through a form. The user would be selecting a certain checkboxes from a retrieval form. Based on the selection we want to provide a CSV file to the user with the filtered data subset. Kindly let me know if we can write this kind of code somewhere(like onsubmit) to achieve our target using chronoform module. Otherwise let us know which Joomla extension can help us to do the task.

We tried writing some code using the references from the forum but that is failing to work. See below:

<?php
$database =& JFactory::getDBO();

$tablename = 'jos_chronoforms_Retrive';
$tables = array( $tablename );
echo $tables;
$result = $database->getTableFields( 'jos_chronoforms_Retrive' ); 
echo $result;
$table_fields = array_keys($result[$tablename]);
echo $table_fields;  
?>


This just outputs.... ArrayArrayArray!
Till such time that we see some data from the above we cannot proceed further. We are stuck totally!!! Kindly Help!!
Kindly let us know if there is a different way of doing things?

Thanks!
Max_admin 24 Jun, 2009
Hi mathurva,

the code above is trying to get the table fields names, why you are trying to do this ? an easier way is to get the fields names yourself and write them inside an array:

$tablefields = array('field1', 'field2', .....);


the approach you are trying to use now may be used if your table is huge or you are doing something dynamic and it should be:

    <?php
    $database =& JFactory::getDBO();

    $tablename = 'jos_chronoforms_Retrive';
    $tables = array( $tablename );
   
    $result = $database->getTableFields( 'jos_chronoforms_Retrive' );
    $table_fields = array_keys($result[$tablename]);
    print_r($table_fields); 
    ?>



Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mathurva 25 Jun, 2009
Hi Max,

Thanks a lot for your help and making us continue to use Chronoforms on our first project! Now we understand fully how to use the forms well.

Being new to the LAMP platform itself, we were trying to use "echo" while we should have been using "print_r()" for dumping the results of the functions.

Thanks again!!!😀
Varun
Max_admin 25 Jun, 2009
no problems😉
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger