Forums

autocomplete + upload

oneira 13 Feb, 2014
I'm creating a simple form but it has posed me two small problems.

I have two questions.

a. I would love to load two or three fields in a search done by the autocomplete, i currently have the autocomplete working, but i can't seem to be able to load the other values into the corresponding textboxes. So, is there any tutorial to help me out?

b. The form has 4 boxes to upload files. I want to create a folder each time the form is submitted and inside the folder to put every linked file. So far, in every tutorial I've seen i can only specify one general folder, that can't be changed every time. How could i do this.

Thanks
GreyHead 14 Feb, 2014
Hi oneira,

a. I think that this can be done, there may be an example in the forums from a year or two ago, it will require custom PHP to return several values, and custom JavaScript to populate several inputs when one of the results is selected.

b. Please see this FAQ. You can modify this to use some other unique submission identifier.

Bob
oneira 16 Feb, 2014
Hello and thanks. Very helpful as usual. However, i haven't been able to find the post you're referring to. Is it possible that it might have been erased? (regarding to a). As for b, thanks to your kind suggestion, i was pretty much able to adapted to my needs.
GreyHead 16 Feb, 2014
Hi oniera,

No, I can't see it either, it may have been a piece of client work.

I took a look at the code and I think that want I would do is to adapt the current AutoCompleter code so that the On Complete function (around line 54 of /administrator/components/com_chronoforms/form_actions/autocomplete_loader/cfaction_autocomplete_loader.php )
				onComplete: function() {
					$('<?php echo $params->get('field_id', ''); ?>').setStyle('background','');
				}
is modified to run an extra function.
The extra function would execute a second Ajax request to get the extra values you want and then to load them into the inputs.

Bob
oneira 17 Feb, 2014
ok, i've been reviewing the code in the file you mentioned, However, one question arises (since i'm not that good at the whole MooTools thing): how could i pass the name of the other fields i would like to include in the search/return values? It is not clear in the code, so i haven't been able to create the second Ajax request. Sorry
oneira 17 Feb, 2014
I'm including the link to the form

http://cfobb.ca/index.php?option=com_chronoforms&chronoform=nomination_form

and as you can see, the first two fields in the first tab are working autocompletes, but i would love to have them linked so when the user chooses in any of the two, the other automatically gets filled. That selection would also trigger another sql query (that i already have, nothing fancy) that would fill the School Name drop-down menu. I know i'm repeating a lot of what i said in my first post, but i thought it would probably help. Thanks again.
oneira 25 Feb, 2014
So far i haven't been able to pull it off Bob. I think that the answer lies within the


<?php
 $form->data['_PLUGINS_']['autocomplete_processor']['result'];
?>


but i don't know how to use/handle it. Any tips would be much appreciated. Thanks
This topic is locked and no more replies can be posted.