TOPIC:

Field drop-down 3 years 1 week ago #232098

  • Topic Author
  • ducman
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 59
  • Thanks: 0
Good morning, I've been searching the forum for the following question: is it possible to select the data that is added from a view from a field? that is, I have view1 (field1 = name field2 = country) and view2 (field1 = countries), so that the countries you add in view2-> field1 can be selected in view1-> field2 as a drop-down.

Thank you very much for your help!!

Please Log in or Create an account to join the conversation.

Field drop-down 3 years 1 week ago #232112

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

I understand what you want to achieve. You would like that what users enter in field2 = country in one View appears as option in select list in field1 = countries in the second View.

It is possible to do so, but it depends on which way you created a View. Did you create a View based on Data Storage or a BreezingForms form?

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

Field drop-down 3 years 1 week ago #232114

  • Topic Author
  • ducman
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 59
  • Thanks: 0
Hello Mihaela, I use only ContentBuilder and to create the cells I go to Data Storage.

Thank you!!

Please Log in or Create an account to join the conversation.

Field drop-down 3 years 1 week ago #232119

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello again,

Here is how you can populate select list in view 2 with countries entered in textfield in view 1.

Go to the second View (the view that needs to have a select list with countries) and navigate to Editable Prepare tab.

In the code area below paste code similar to this one
$test = "";
$servername = "yourservername";
$username = "yourusername";
$password = "yourpassword";
try {
    $conn1 = new PDO("mysql:host=$servername;dbname=joomla", $username, $password);
    // set the PDO error mode to exception
    $conn1->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    // echo "Connected successfully"; 
    foreach($conn1->query('Select country FROM gmb0v_datastoragename ') as $row) {    
        $test .= $row['country'].";".$row['country']."\n";
    }
}
catch(PDOException $e)
    {
     echo "Connection failed: " . $e->getMessage();
    }

try {
    $conn2 = new PDO("mysql:host=$servername;dbname=joomla", $username, $password);
    // set the PDO error mode to exception
    $conn2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    // echo "Connected successfully"; 
    $query = $conn2->prepare("UPDATE gmb0v_contentbuilder_storage_fields SET group_definition = '$test' WHERE id = 54");
    $query->execute(); 
       }
catch(PDOException $e)
    {
    echo "Connection failed: " . $e->getMessage();
    }
NOTE: Here are the changes that you need to make in the code:

1) Set $servername, $username and $password to the correct values for your case.

2) Replace this query 'Select country FROM gmb0v_mystorage ' with the correct query for your case. Replace country with the element's Name in Data Storage where user enters the country. Also, replace mystorage with the name of Data Storage where this element country is.

3) In this line of code:
$test .= $row['country'].";".$row['country']."\n";
replace every instance of country with the element's Name in Data Storage where user enters the country.

4) In this query:
"UPDATE gmb0v_contentbuilder_storage_fields SET group_definition = '$test' WHERE id = 54"
replace 54 with the ID of the select list in second view that you want to fill in with countries.

Let me know whether you have managed to set this so that select list is properly populated.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

Field drop-down 3 years 6 days ago #232219

  • Topic Author
  • ducman
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 59
  • Thanks: 0
Good afternoon Mihaela, sorry I have not answered before, I tried to use the code you provide but it does not work for me, surely I do not know how to put it right.

Sorry you bothered, greetings!

Please Log in or Create an account to join the conversation.

Field drop-down 3 years 6 days ago #232245

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

Please send me your code so I can take a look at what you might have set wrong.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.049 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!