10 years ago
2
Topic

Hi,

I am building an enquiry form with the following fields: Name, Your Email, Phone, Select Product, Message and a submit button. The form works fine when it is configured to send the enquiry to one (or predefined email address.)

The fields are configured as follows:

  • Name - text
  • Your Email - email
  • Phone - text
  • Select Product - dynamic select (selects articles from a category with title as name and id as value) --> option A, option B, option C, option D
  • message - textarea
  • Submit - submit button
  • Send Enquiry - email (hidden).... sends the enquiry

What I want is a case where if someone selects Option A in the select box... the message/email is mailed to email address A

Option B..... mail to address B 

.... and so on.

How can I go about this?

I have altered the article form to include a field in the backend where an email can be manually entered in case of enquiries to that article. 

Now the problem is how to use that email field from each article, which is stored in #__content table, and compare with what value has been selected in the Select Box... to send email to that address

To be more clear, because the select box returns article id as value.... how can set a conditional (if possible), on the hidden email field to load addresses from the field stored in database by comparing with what has been selected in the Select Box?

I need help... alternative suggestions are welcome on how to implement that.

Get a Book for SEBLOD
10 years ago
1
Level 1

Hahaha... Seblod is a beast of a platform... the possibilities are endless and to get the power of it, you gotta dig deeper.

Now I just found the solution to my own problem!

Here it goes

Since the emails are stored together with the articles, and the articles populate the Dynamic select box... instead of using id as value, I modified the SQL query a bit like so:

---

SELECT title AS text, id AS value FROM `#__content` WHERE `catid` =93 AND `state` =1

SELECT title AS text, enquiry_email AS value FROM `#__content` WHERE `catid` =93 AND `state` =1

in this case, enquiry_email is the address where the form should be sent to, for each case! 

And since there is a field to enter the email in the backend... no one will worry about going to Seblod Forms to start changing the email addresses!

That's it, and the emails start flowing to different addresses based on the choice in the Select Box :)

Good day y'all.

693 Posts
rpoy
10 years ago
0
Level 2

Hi ericode,

Welcome to the SEBLOD forums.

Glad you found a solution!  

In your posts that are solved, please mark them as solved with the check box.

thanks,

Randy

Get a Book for SEBLOD