Forums

Is This Possible

Tgoodrich 06 Mar, 2014
Hi,

I am putting together a contact directory for my towns website and I have an idea how I want it but I'm not completely sure how to go about it or if its even possible.

Here's basically what I'm trying to do.

1st - I have used RocketTheme's RokSprocket to create a collapsible accordion list. In each list I will have a picture, name, hours and email address of the person that needs to be contacted. This part I already know how to create.

2nd - I also want to have a Chronoforms button or text link that opens a contact form in a lightbox (rokbox in my case). This button/link will be added to each persons contact information as an optional way to contact them. I'm not sure how to go about it yet but that should be straight forward and doable.

Lets say someone is viewing my contact page, they are presented with my collapsible list of each town office. They want to contact our Town Clerk so they found Town Clerk in the list and click on it. This opens the previously collapsed list and they now see all the contact information for the Town Clerk. They decide to click the "Contact Form" button which opens the rokbox containing the form. This form will send an email to the Town Clerk after submission.

Now here's what I'm not sure of. Can I get away with making just one form that works for all contacts? This one form would have to some how know who to email automatically.

I know I could make one form and have a dropdown in the form so the viewer can choose who the form info will be emailed to, or I could just make one form for each town office contact in the directory but what I want to do seems like a good challenge and will only help me learn Chronoforms better.

So is what I want possible and if so how can I get one form to know who to email depending on my viewers contact choose.

Thanks
Tgoodrich 06 Mar, 2014
Sorry calculus00, doesn't help.
GreyHead 07 Mar, 2014
Hi Tgoodrich,

Can you get away with one form? Yes, the link (or mini-form) that opens the form has to include enough information to identify the contact - possibly just their user ID, or a DB record ID. Then the form can look up the info matching that ID and use that to populate the form and to manage the actions after the form is submitted.

Bob

PS Joomla! 3 has a Contacts component that is similar to this - might that help?

PPS You can also use sliders with ChronoConnectivity (or a custom form) that will work like this, Or at least I have used them with CC/CFv4 not yet with v5.
Tgoodrich 29 Apr, 2014
HI Bob,

Very sorry for the seriously late reply on this.

I am thinking of going with your first suggestion but i unfortunately do not understand how to accomplish what you are saying.

I have only got as far as getting my form to appear in a popup like i wanted.

As per your suggestion could you give me an example of what the link to my form should look like when including a unique identifier such as a user id?

Here is an example of how the link is currently formed:
<a href="http://184.154.228.17/~townofsa/index.php?option=com_chronoforms5&chronoform=demo-basic-contact-captcha&tmpl=component" target="_blank" class="jcepopup noicon" type="iframe">


Also, once i get an unique identifier into the link, what would I have to do to get the form to look up the matching info.

Thanks
Tgoodrich 30 Apr, 2014
HI,

Is this what the link should look like?
<a href="http://184.154.228.17/~townofsa/index.php/component/chronoforms5/?chronoform=demo-basic-contact-captcha&id=john-doe&tmpl=component" target="_blank" class="jcepopup noicon" type="iframe">


&id=john-doe
being the unique ID.

If so how do I get chronoforms to pick this up so it will send and email to John Doe?
Max_admin 30 Apr, 2014
Hi Tgoodrich,

That id should be fine if you don't have a huge list of users, you can then capture the id in a "custom code" action before the email action and find the associated email address which you can then use as a "dynamic to":

<?php
$emails = array(
"john" => "john@test.com",
"john-deo" => "john-deo@test.com",
);
$form->data["user_email"] = $emails[$form->data["id"]];

Then add "user_email" to the "dynamic to" field!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Tgoodrich 07 May, 2014
Hi Max,

I tried the code you gave and it does work perfectly but in the past few days I have decided I need to do something a bit different.

I am now thinking I need to store the emails addresses in a database table due to their being a huge list of users and needing other info included in the form.

I have created a separate form to upload the following records to a database table:
member_id (EX: john-doe), name (EX: John Doe), phone, email_address, uploaded_image, other_info

As in my previous post on this when the user submits the form I need it to grab the correct email address from the database based on the forms id included in the forms url. So basically I need the form to do exactly what you worked out before but grab the email address from the database instead.

The second part of this is I also want to include some structured html in the head of the form that shows the information from the database i listed above. Im guessing I will need to create a custom field in the head of my form and some how enter php to form the html structure and pull in the information contained in the database. Only I'm not sure how to do that. If you can, please give an example of what i should do.

Just so I've explained it correctly heres what i have so far:
I have a webpage with a list of people, each of the persons names are in the form of a link.
Each link points to the same exact form. Even though the links all go to the same form, each link also includes a unique id
&id=john-doe
for that person.
When the link is clicked it opens the form in a JCE popup.

When its all said and done this is what I would like to have:
Based on the id contained in the link, when the form opens it should show an image of the person and their basic contact information (all the info created in the database above).
If the user decides to fill out and submit the form it goes to the proper recipient based on the id in the link.
Max_admin 08 May, 2014
Hi Tgoodrich,

The easy answer is that you need a "db read" action in the "on load" to load the user info including image and then you need to display it, you also need a similar "db read" in the on submit to load the correct recipient info!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Tgoodrich 08 May, 2014
Hi Max,

I have the "db read" in the onload event and have it pointing to the table that has the information the form needs but I dont know how to have the form pick up the id contained in the link and match it to the corresponding member_id and its records if that makes sense.

Maybe it would be best if we work this out one step at a time. I'm finding it hard to understand and there are no clear instructions on how to do what i need. I'm starting to think I need a background in php and mySQL to understand how the forms work lol. Please be patient with me🙂

So a couple of things to get me started,
1. should I have my table set up so the primary key is the "member_id"? The records in the "member_id" column match the id in the forms opening link. If yes, what "type" should it be e.g. INT, VARCHAR, etc..

2.How do I make the connection in the "db read" to get the matching records?

3. Do you have and example of how I can call the matching records into some html in the form designer?

4. How do I display an image whos file name is stored in the database and the actual image itself is stored in chronoforms default upload location?

Maybe we can start here and I can ask questions as needed. This should give me a good start though.

Thanks
Max_admin 09 May, 2014
Hi Tgoodrich,

#1- No need for that
#2,3- yes, in the conditions box:

<?php
return array("member_id" => $form->data("id"));

Where "id" is the name of the param in the URL and "member_id" is the db field!
#4- after loading the file name from the database, just append the file path using PHP!

<img src="link_to_files_here/<?php echo $form->data["image"]; ?>" />


Regards,
Max
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.