0

Use javascript click event to set a field value

Whti the html() function I has created a <select> tag and a <button>. When I click the button I get the selected value.

How can I set a table field now with the result?

Here is the code.

<div style="display: flex;align-items: center;">
    <select id="selection2" class="choice">
        <option value="1">Test 1</option>
        <option value="2">Test 2</option>
        <option value="3" selected>Test 3</option>
        <option value="4">Test 4</option>
    </select>

    <div class="component editor button">
        <input type="button" wight="100%" id="btnSelect2" class="nx-button-text blue" style="padding:0 2em" value="Apply" />
    </div>
</div>

<script type="text/javascript">
var button = document.getElementById('btnSelect2');
var selected = document.getElementById('selection2');
button.addEventListener("click", function(event)
{
    event.preventDefault();
    // Table.Field = selected.value; <--- how does this work?
});
</script>

2 replies

null
    • Sean
    • 3 yrs ago
    • Reported - view

    If you are using the Mac app and working with a local database, it doesn't work. If you are using Ninox cloud, you will need to use the API...

     

    https://ninox.com/en/manual/api/api-introduction

    • GFV
    • Detlef_Stover
    • 3 yrs ago
    • Reported - view

    I'm using the cloud.
    Do you mean I have to use the htpp function?
    And I have to go outof the cloud to change the field?
    Strange.
    I have thought that there is a smarter solution.

    But thank you Sean.

Content aside

  • 3 yrs agoLast active
  • 2Replies
  • 780Views