Hi!
I have a working double drop down (as I bought the how-to docs), schools and children in it. I want the following: when the users select the child and press the submit button, then name, address, date of birth etc. from database will appear in a table.
Is it possible to make it?
I have a working double drop down (as I bought the how-to docs), schools and children in it. I want the following: when the users select the child and press the submit button, then name, address, date of birth etc. from database will appear in a table.
Is it possible to make it?
Hi szivett,
Yes, you can continue to a second form using the DB Multi-Record Loader to create your table. There is a built in Data Displayer that may well do what you need.
Bob
Yes, you can continue to a second form using the DB Multi-Record Loader to create your table. There is a built in Data Displayer that may well do what you need.
Bob
Hi Bob,
I am new to use Chronoform and be trying to know more about it. Now I have a similar requirement in my application about membership management.
We have two tables in database, table member is used for member's basic information such as first name, last name, gender, birthday, addressID etc.; table address is used for address detail. Multiple member may share one same address (such as same family members), that's why we use a foreign key addressID to link these two table.
Now I designed one chronoForm called memberForm which includes all basic information and address information together. I used one drop down component(for member's addressID field) to let user to select existing address(use multiple record component) or select "create new address". When user submit the form, if user selected "created new address", the new address will be saved first and new addressID will be returned to the drop down component, the member's basic information will be saved to table member.
Everything looks fine, but now I have a problem, when user select a existing address from the drop down list(which only show city name and street name and number, the id is addressID), how can I show the detail about the address in the form (such as post code, unit number, main intersection etc.). It seems like when I select one value in the drop down list, I need to connect to the database to get the detail and then show them in the form? How can I do that?
I found some tips about dynamic changing the second drop down value list based on the selection of the first drop down, but in my case, second part is not the drop down. How can I do it?
I hope I have described my case clearly.
could you give any help?
Thanks
Sandy
I am new to use Chronoform and be trying to know more about it. Now I have a similar requirement in my application about membership management.
We have two tables in database, table member is used for member's basic information such as first name, last name, gender, birthday, addressID etc.; table address is used for address detail. Multiple member may share one same address (such as same family members), that's why we use a foreign key addressID to link these two table.
Now I designed one chronoForm called memberForm which includes all basic information and address information together. I used one drop down component(for member's addressID field) to let user to select existing address(use multiple record component) or select "create new address". When user submit the form, if user selected "created new address", the new address will be saved first and new addressID will be returned to the drop down component, the member's basic information will be saved to table member.
Everything looks fine, but now I have a problem, when user select a existing address from the drop down list(which only show city name and street name and number, the id is addressID), how can I show the detail about the address in the form (such as post code, unit number, main intersection etc.). It seems like when I select one value in the drop down list, I need to connect to the database to get the detail and then show them in the form? How can I do that?
I found some tips about dynamic changing the second drop down value list based on the selection of the first drop down, but in my case, second part is not the drop down. How can I do it?
I hope I have described my case clearly.
could you give any help?
Thanks
Sandy
Maybe I described the question too complex, let me make it simple.
I have a drop down list about address ID list, when I select one ID, I hope the address detail can be dynamicly retrieved from database such as city, street name, street number etc. , these detail information will be shown on other edit components of the same form.
how can I do it?
Sandy
I have a drop down list about address ID list, when I select one ID, I hope the address detail can be dynamicly retrieved from database such as city, street name, street number etc. , these detail information will be shown on other edit components of the same form.
how can I do it?
Sandy
Hi Sandy,
I understand the problem I think. You can do this with a custom Ajax query - you need to get the query to pass back a JSON array and then you can parse that in JavaScript and put the results wherever you want them. If this all sounds very technical to you I'm sorry but it is a bit that way.
The simpler alternative is to get a record ID for the address in the form and then to look up the remaining data after the form is submitted.
Bob
I understand the problem I think. You can do this with a custom Ajax query - you need to get the query to pass back a JSON array and then you can parse that in JavaScript and put the results wherever you want them. If this all sounds very technical to you I'm sorry but it is a bit that way.
The simpler alternative is to get a record ID for the address in the form and then to look up the remaining data after the form is submitted.
Bob
Hi Bob!
Thank you! How can I place the second form under the first one? And how can I get the selected item's value from drop down?
Thank you! How can I place the second form under the first one? And how can I get the selected item's value from drop down?
Hi Sandy,
I don't think that there is a second form?
And how you get the drop-down value depends on how you are doing the query? It it's JavaScript then $('dropdown_id').value will get it if it's PHP then $form->data['dropdown_name'] is needed.
Bob
I don't think that there is a second form?
And how you get the drop-down value depends on how you are doing the query? It it's JavaScript then $('dropdown_id').value will get it if it's PHP then $form->data['dropdown_name'] is needed.
Bob
Hi Sandy,
Ah, sorry, I didn't read back far enough. That was referring to a two-page form with one showing *after* the other; not one under the other.
Bob
Ah, sorry, I didn't read back far enough. That was referring to a two-page form with one showing *after* the other; not one under the other.
Bob
HI Bob,
Could you give me a code sample about putting data back into JSON array in a chronoform. Now I can get multiple records data in a custom code before "show HTML" in a chronoForm and pass them into a drop down component, but do not know how to save them into a JSON array.
Thanks
Sandy
Could you give me a code sample about putting data back into JSON array in a chronoform. Now I can get multiple records data in a custom code before "show HTML" in a chronoForm and pass them into a drop down component, but do not know how to save them into a JSON array.
Thanks
Sandy
Hi Sandy,
I'm not sure exactly what code you want to encode but a typical example might be this - used in a Custom Code action:
Bob
I'm not sure exactly what code you want to encode but a typical example might be this - used in a Custom Code action:
<?php
$form->data['json_some_array'] = json_encode($form->data['json_some_array']);
?>
and to unpack again use json_decode()Bob
Hi Bob,
Your sample code really gave me a light. Now I have finished the task as below:
Inside one Custom Code, I get the query result for one table using
Then I can operate the data within the page without communicating with the database
I seems complex, but it works well for me, I know it is not the best solution, but I am satisfied with it so far.
Thanks
Sandy
Your sample code really gave me a light. Now I have finished the task as below:
Inside one Custom Code, I get the query result for one table using
$db->setQuery($query); $results = $db->loadObjectList();
transform the result into a array, change array into a JASON using $json = json_encode($resultsArray);
Finally I deliver it into javascript using <script type="text/javascript">
var myjson = <?php echo $json; ?>; </script>
Then I can operate the data within the page without communicating with the database
I seems complex, but it works well for me, I know it is not the best solution, but I am satisfied with it so far.
Thanks
Sandy
This topic is locked and no more replies can be posted.