Hi,
This is my first time trying to work with database tables in Joomla (2.5.9) and I'm going around in circles trying to figure out the simplest way to do what I want:
I have a table with Business Types and each type has an associated fee. There are 6 possible fees, basic monthly, basic annual, silver monthly, silver annual, gold monthly and gold annual.
What I want to do is have a dropdown box populated with all the business types. When a user selects the type of business in the dropdown box then the 6 empty boxes underneath fill with the appropriate fee fields from the same record.
Is this possible to do with Chronoforms and ChronoConnectivity and if so can someone point me in the right direction. Its been years since I did any coding so be as detailed as your time permits.
Apologies if this is dealt with already but I couldn't find a topic covering my question. Then again my head is frazzled as I've been trying to figure this out for days and I'm sure my client is wondering whats taking so long so I may have missed a good topic.
Thanks
K
This is my first time trying to work with database tables in Joomla (2.5.9) and I'm going around in circles trying to figure out the simplest way to do what I want:
I have a table with Business Types and each type has an associated fee. There are 6 possible fees, basic monthly, basic annual, silver monthly, silver annual, gold monthly and gold annual.
What I want to do is have a dropdown box populated with all the business types. When a user selects the type of business in the dropdown box then the 6 empty boxes underneath fill with the appropriate fee fields from the same record.
Is this possible to do with Chronoforms and ChronoConnectivity and if so can someone point me in the right direction. Its been years since I did any coding so be as detailed as your time permits.
Apologies if this is dealt with already but I couldn't find a topic covering my question. Then again my head is frazzled as I've been trying to figure this out for days and I'm sure my client is wondering whats taking so long so I may have missed a good topic.
Thanks
K
Hi fewcon,
You can do this in ChronoForms I think.
Probably the easiest way is to use the DB Multi Record Loader action to load the data and then use JavaScript to manage the population of the various data fields. I can't think of any method that doesn't require some coding :-(
Bob
You can do this in ChronoForms I think.
Probably the easiest way is to use the DB Multi Record Loader action to load the data and then use JavaScript to manage the population of the various data fields. I can't think of any method that doesn't require some coding :-(
Bob
Hi fewcon,
One more idea, you can add a "Find" button which submits the form when clicked after selecting the business type, then a "DB record loader" action can find the details of the selected record, you can then use the "Show html" action in the "on submit" event to display the returned data into the form fields, fields names should match the database table columns names.
You only need Chronoforms for that.
But without using that "find" button, you will have to manage many stuff using JS code and things will get complicated for you.
Regards,
Max
One more idea, you can add a "Find" button which submits the form when clicked after selecting the business type, then a "DB record loader" action can find the details of the selected record, you can then use the "Show html" action in the "on submit" event to display the returned data into the form fields, fields names should match the database table columns names.
You only need Chronoforms for that.
But without using that "find" button, you will have to manage many stuff using JS code and things will get complicated for you.
Regards,
Max
Hi All,
I have pretty much the same request:
I have in my Database a table with vendor data: e-mail, company name, tel etc.
Thee is also one column with username of people who submitted the form, so that i can select via a Mysql request all the rows relatd to the people who filled and submitted the form.
In a Chronform form, I have different field related to the colum + I have a dropdown field where i display a list of vendor related to the submitter and i display a list of the company name of vendor.
I would like to fill the other field (name, e-mail, firstname, etc...) when the user select the company name in the dropdown so that the other field are already filled automatically with data.
Below is loaded data in the session after quering the database.
Right now i success to display the company name in the dropdown and i think i will need to use javascript to set the other field with one OnChange but I miss a few information :
1./ How to pick the value in the array in the session (as I have loaded all the data from the database table to the session, they are accessible). For example: vendor_first_name
How to access this data knowing that the array got several vendor inside . I have read about Model ID, but to be honest I have difficulties to understand how to use it (especially in terms of syntax) and the how to access data in the session using Model ID both in PHP and in Javascript language ?
Work with an example (such as the fex lines of code i included) would help greatly.
2./ How to perform the set of the field in javascript to display the value in the field.
Thanks for your help
I have pretty much the same request:
I have in my Database a table with vendor data: e-mail, company name, tel etc.
Thee is also one column with username of people who submitted the form, so that i can select via a Mysql request all the rows relatd to the people who filled and submitted the form.
In a Chronform form, I have different field related to the colum + I have a dropdown field where i display a list of vendor related to the submitter and i display a list of the company name of vendor.
I would like to fill the other field (name, e-mail, firstname, etc...) when the user select the company name in the dropdown so that the other field are already filled automatically with data.
Below is loaded data in the session after quering the database.
[list_vendor] => Array
(
[0] => Array
(
[cf_id] => 1
[cf_uid] => 1f55a15ab4030a00897a92ddc638b3e3
[cf_created] => 2013-02-23 20:37:03
[cf_modified] => 0000-00-00 00:00:00
[cf_created_by] => 43
[cf_modified_by] => 0
[cf_ipaddress] => 127.0.0.1
[cf_user_id] => 43
[order_vendor_list] =>
[vendor_company_name] => Nike
[vendor_first_name] => Albert
[vendor_name] => Rico
[vendor_email] => albert.rico@nike.com
[vendor_phone] => +14343553323
[vendor_address] => 1 wall stree
[vendor_city] => New York
[vendor_zipcode] => 0000
[vendor_country] => USA
[input_submit_15] => Submit
[back] =>
[cfu_username] =>
)
Right now i success to display the company name in the dropdown and i think i will need to use javascript to set the other field with one OnChange but I miss a few information :
1./ How to pick the value in the array in the session (as I have loaded all the data from the database table to the session, they are accessible). For example: vendor_first_name
How to access this data knowing that the array got several vendor inside . I have read about Model ID, but to be honest I have difficulties to understand how to use it (especially in terms of syntax) and the how to access data in the session using Model ID both in PHP and in Javascript language ?
Work with an example (such as the fex lines of code i included) would help greatly.
2./ How to perform the set of the field in javascript to display the value in the field.
Thanks for your help
Hi Lauren,
#1- you can pick the value you noted in a string this way: {list_vendor.0.vendor_first_name} or if you have a field then the field name should be: list_vendor[0][vendor_first_name], or using PHP:
#2- this way:
Regards,
Max
#1- you can pick the value you noted in a string this way: {list_vendor.0.vendor_first_name} or if you have a field then the field name should be: list_vendor[0][vendor_first_name], or using PHP:
<?php echo $form->data[list_vendor][0][vendor_first_name]; ?>
#2- this way:
$('field_id').set('value', 'here');
assuming you have mootools loaded.Regards,
Max
Thanks Max,
I will give a try for this.
Thanks
I will give a try for this.
Thanks
Hi Max,
Here is the syntax i am trying to use to fill a javascript array with the value of data session, after what I will compare the value with the company name to select the right data with a IF.
It seems I have some difficulties with this loop as javascript looks to block on this statement:
I suppose the problem comes from the i inside the php code ?
Here is the syntax i am trying to use to fill a javascript array with the value of data session, after what I will compare the value with the company name to select the right data with a IF.
It seems I have some difficulties with this loop as javascript looks to block on this statement:
for(i = 0; i < var_total; i++){
myArray[i] = <?php echo $form->data[list_vendor][i][vendor_first_name]; ?> ;
alert("value is" +myArray[i]);
}
I suppose the problem comes from the i inside the php code ?
up, any help is appreciated :-)
Hmmm, you may try this:
I think that should do it!
Regards,
Max
<?php
$vendors = array();
foreach($form->data[list_vendor] as $k => $v){
$vendors[] = $v;
}
?>
var myarray = [<?php echo "'".implode("','", $vendors)."'"; ?>];
console.log(myarray); //use firebug to check it then comment this line when you finish testing
I think that should do it!
Regards,
Max
This topic is locked and no more replies can be posted.