dropdown – Use VBA to add multiple fields to one record while also adding a category to each field

I could not find the answer to this question elsewhere. I am a new VBA user.

I have a very simple form for entering data on plant specimens. There are only 3 fields that have drop down boxes. Two fields, “Species” and “Code” reference information from another table called “MasterVegList” to facilitate field data entry.

In order to allow the end user to add new species into to the form and the “MasterVegList” table, I wrote the following VBA code:

Private Sub Code_NotInList(NewData As String, Response As Integer)
Dim strTmp As String

    'Get confirmation that this is not just a spelling error.
    strTmp = "Add '" & NewData & "' as a new category?"
    If MsgBox(strTmp, vbYesNo + vbDefaultButton2 + vbQuestion, "Not in list") = vbYes Then

        'Append the NewData as a record in the Categories table.
        strTmp = "INSERT INTO MasterVegList ( Code ) " & _
            "SELECT """ & NewData & """ AS Code;"
        DBEngine(0)(0).Execute strTmp, dbFailOnError

        'Notify Access about the new record, so it requeries the combo.
        Response = acDataErrAdded
    End If
End Sub

Private Sub Species_NotInList(NewData As String, Response As Integer)
Dim strTmp As String

    'Get confirmation that this is not just a spelling error.
    strTmp = "Add '" & NewData & "' as a new category?"
    If MsgBox(strTmp, vbYesNo + vbDefaultButton2 + vbQuestion, "Not in list") = vbYes Then

        'Append the NewData as a record in the Categories table.
        strTmp = "INSERT INTO MasterVegList ( Species ) " & _
            "SELECT """ & NewData & """ AS Species;"
        DBEngine(0)(0).Execute strTmp, dbFailOnError

        'Notify Access about the new record, so it requeries the combo.
        Response = acDataErrAdded
    End If
End Sub

The problem is that when a new species is entered, a new record is created for both species and code in the MasterVegList table. I need both species and code to be entered into the same record. Please note that I am referring to the MasterVegList table, not the table meant to be populated using the form.

لینک منبع

javascript – Auto select dependent dropdown with jquery json

I have a dynamic and dependent dropdown below. The parent dropdown fetch the active ID from database but how to auto select the child dropdown value that is stored in the same table and set it to “selected”?

Parent Dropdown (php pdo):


$keynr = new Keynr($db);
$stmt = $keynr->read();

// put them in a select drop-down
echo "<select id='key_dropdown' class='form-control' name='keyindex' required>";
    echo "<option value=''>Wähle Schlüssel...</option>";

    while ($row_content = $stmt->fetch(PDO::FETCH_ASSOC)){

         // current category of the product must be selected
            echo "<option value='$id' selected>";**
            echo "<option value='$id'>";

        echo "$keynr - $content</option>";
      echo "</select>"; 


Child dropdown (Jquery):

<select id='repairkey_dropdown' name='keyindex2' class='form-control' required>
   <option value=''>Wähle Schadensbild ....</option>

  $(function () {
// detect change of dropdown

    // get id of selected team 
    var key_id=$(this).find(':selected').val();

        // set json url
        var json_url="keys_json.php?key_id=" + key_id;

        // get json data
        jQuery.getJSON(json_url, function(data){

            $("#repairkey_dropdown").append("<option value='0'>Wähle Schadensbild ....</option>");

            jQuery.each(data, function(key, val){
                $("#repairkey_dropdown").append("<option value='" + val.key_repairkey2 + "'>" + val.content + "</option>")


Child dropdown (Jquery Json):

// set json headers
header("Access-Control-Allow-Methods: GET");
header('Content-Type: application/json');

$key_id=isset($_GET['key_id']) ? $_GET['key_id'] : die('Auftrags ID nicht gefunden.');

include_once '../config/database.php';
include_once '../objects/repairkeys2.php';

$database = new Database();
$db = $database->getConnection();

$repairkey2 = new Repairkey2($db);

$stmt = $repairkey2->readOneAdminDropDown();
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo json_encode($results);

I´m not sure what is the best way to do this.

Thanks! 🙂

لینک منبع

java – Dropdown CSS Selector in selenium

I have following page:
I need to click Sort By ‘name’ on dropdown list in Selenium, trying to do this with this code

  public void f(){
  verifyTitle(baseUrl, "Home page");
  driver.findElement(By.cssSelector(".level0 ")).click();
  verifyTitle(driver.getCurrentUrl(), "Mobile");

  Select dd = new Select(driver.findElement(By.cssSelector("select[title=Sort By][css=1]")));


What’s wrong with this code? Quotation marks are in right place?

لینک منبع

perl – How to select an option in a dropdown list using WWW::Mechanized::PhantomJS

I am trying to select an option that has no value using WWW::Mechanized::PhantomJS

I have tried both methods below:

$mech->set_fields($name, $value);
$mech->field($name, $value);

This is the select element I am trying to select from:

<select class="calendarDateInput" id="enddate_Day_ID" onchange="enddate_Object.changeDay(this)">

I have not been able to select any of the options. Apparently phantomjs does not have the select method. I am still a noob in perl.

لینک منبع

php – Dropdown list – Modification

I have a dropdown list with 5 elements (Volleyball, Handball, Rugby, Basketball, Autres)
I wish for example to select the element “Rugby” in my form, then confirm.

My problem is when I wish to change my old choice in my form (edit); the element “Rugby” is not the element which has been save previously.
By default I always have the element “VolleyBall”.

[![<td>Type de Club:</td><td>
            <select name="type_club" style="width:144px">

لینک منبع

javascript – Amount changes if dropdown is changed PHP+JS

In the table below, I have 2 items named “Jacket” and “Uniform”. Each item has a dropdown to select the desired quantity. What I want to happen is for the amount to automatically change when the quantity is changed. For example, the unit price of a uniform is 1,400 Pesos. If the user desires to buy 2 uniforms, the amount will automatically change from 1,400 to 2,800 Pesos. For “Jacket” the amount automatically changes when the quantity changes. The unit price of a jacket is 700 Pesos. Hence, when the quantity is changed from 1 to 2, the amount changed from 700 to 1,400 Pesos. I don’t understand why the same is not happening to “Uniform”, that is, when the quantity changes the amount does not change. Any help would be greatly appreciated. Please see my code below. Thank you very much.

Here are my code:

 @foreach($data['tuition_other'] as $other)
         <td id="item_amt">{{number_format($other->item_amount,2,'.',',')}}</td>
             <select name="item_quantity" class="iqty_class" id="iqty_id">
                 @for ($i=1; $i<=$other->max_quantity; $i++)                                                                            
                     <option value="{{ $i }}">{{ $i }}</option>
             <input type="hidden" id="item_val" value="{{ $other->item_amount }}">
         <? $total_other += $other->item_amount; ?>


$('body').on('change','.iqty_class', function(){
    var item_amt = $('#item_val').val();
    var item_qty = $('.iqty_class').val();
    var total_amt =  item_amt * item_qty;
    var c = total_amt.toLocaleString('en-US', {minimumFractionDigits: 2});

لینک منبع

javascript – Adding context menu or dropdown menu in Sigma JS graph

What’s the best or preferred way to add a dropdown or context menu in a Sigma JS graph that appears at the mouse-click position, over the graph itself? I’ve seen libraries like contextmenu.js, but can it be done in a simpler or better way? My goal is to be able to click a node and then click a menu option, passing data from the node to functions called through click events on the menu.

لینک منبع

javascript – Filtering dropdown based on another dropdown selection

I have 2 separate dropdown lists. I need to get each dropdown to filter each other. Every example I have seen so far is an example for dropdowns that have the options hard-coded in. Mine uses a query to populate the options.

So how could I correctly have each dropdown menu filter each other?

Here is my HTML for the dropdowns:

<select id="collector" onchange="showUser(this.value)">             
    <option value="" selected disabled>Collector Name</option>
        <?php foreach($collect->fetchAll() as $name) { ?>
    <option class="<?php echo $name['Collector Name'];?>" value="<?php echo $name['Collector Name'];?>"><?php echo $name['Collector Name'];?></option>
        <?php } ?>

<select id="date" onchange="showUser(this.value)">              
    <option value="" selected disabled>Bill Date</option>
        <?php foreach($bill_date->fetchAll() as $date) { ?>
    <option class="<?php echo $date['Date'];?>" value="<?php echo $date['Date'];?>"><?php echo $date['Date'];?></option>
        <?php } ?>

Code that runs each time the dropdown is changed:

if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("txtHint").innerHTML = this.responseText;

            var newTableObject = document.getElementById('billing_table');


    // ---- Gets value of collector dropdown selection -----
        var e = document.getElementById("collector").value;

         type: 'POST',
         url: 'index.php',
         data: e,
         success: function(response) {

    // ---- Gets value of the current selection in any of the dropdowns ----    

        document.getElementById('billing_table').style.display = 'none';

Query on my index.php page:

$value = ($_GET['e']);

$billdate = "SELECT [Date]
  FROM [vExample]
  WHERE [Collector Name] = '$value'";

I don’t want to send the value to my dropdown-display.php page since my queries that populate the dropdowns are on my index.php page. However, if I put the value variable in the query, then it runs that query on load before a collector selection can be made and my bill date dropdown will then not be populated.

لینک منبع

javascript – Set JSON object value from Dropdown and text input

I have this dropdown in my HTML next to a text box and a button.

What I want to happen is the user selects something from the dropdown. Then they input a number in the box. When they click save, it takes that number, and assigns it to the coordinating location in the JSON object for the item they selected from the drop down.

Here is kind of what I have so far. The commented out line is what I want to happen at that spot. Not sure how to code it.


var userIngredients = {
    function setUserAmountToVariables()

    var tempNumber =  document.getElementById("itemInput").value;

    var tempItem = document.getElementById("dimeADozen");

//set tempnumber to whatever the user selected as the item from the dropdown (in useringredients object)

<select id="dimeADozen">
    <option data-value="userIngredients.Acorn">Acorn</option>
    <option value=userIngredients.Apple>Apple</option>
    <option value=userIngredients.Armoranth>Armoranth</option>
    <option value=userIngredients.BigHeartyRaddish>Big Hearty Raddish</option>  
<input type="number" id="itemInput" min="0" max="99999">
<button onclick="setUserAmountToVariables();">Save Ingredient</button>

لینک منبع