DMXzone App Connect Support Product Page

select onchange

Reported 19 Mar 2018 11:09:46
1
has this problem
19 Mar 2018 11:09:46 Hans Haverlach posted:
I've a select box on my app connect page that dynamically populates with options. The purpose is that when you choose a option in the select box, a server connect is loaded with the option VALUE as an input parameter:

<select name="producten" id="producten" dmx-bind:options="sv_producten.data.query1" optiontext="idprod_naam" optionvalue="idprod_id"  dmx-on:change="svbestellingen.load({projectid: <?php echo $_SESSION['projectid'] ?>, prod_id: value})" >
        <option value="">Kies een product</option>
    </select>
<div><h4>Your orders: </h4></div>
       <div dmx-repeat:repeat1="data_view1.data">
        {{idprod_naam}} - {{idbest_date.formatDate("dd-M-yyyy")}}
      </div>

When I preview the page in a browser, and choose a product in the select box, nothing happens. BUT when I choose again a different option, the order data is loaded but with the option value from the previous selected option. When I choose again a different option, data again is loaded with the option value from the selected option, just before.

So the data is loading always with a value input 'one behind'. I hope this is clear.
How can I solve this?

Replies

Replied 19 Mar 2018 11:20:18
19 Mar 2018 11:20:18 Hans Haverlach replied:
Just found a solution:
You have to use: dmx-on:updated:

<select name="producten" id="producten" dmx-bind:options="sv_producten.data.query1" optiontext="idprod_naam" optionvalue="idprod_id"  dmx-on:updated="svbestellingen.load({projectid: <?php echo $_SESSION['projectid'] ?>, prod_id: value})" >
        <option value="">Kies een product</option>
        

    </select>

Reply to this topic