0

Good day,

I am a new user to stack overflow and have an input field on which token field is loaded, when I enter tags manually it works fine, however when I try to input tags / options using another javascript function it doesn't add any tags. If I remove token field from the input field, the input field can receive a comma separated list of values fine. There seems to be a conflict with token field.

$('#submit_senderids').click(function() {
  $('#senderids_input').val('New Tag');
}); //This click event should update the above input field value
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input class="form-control" type="text" placeholder="Sender id" id="senderids_input" data-tokens="" name="sender_ids">//Token triggered on this input field.
echo '<input class="checkbox_items" type="checkbox" name="selected_senderids" value="'.$row["sender_ids"].'">  ';
echo '<label class="col-4-md">'.$row["group_name"];
echo '</label>';
echo '&nbsp;&nbsp;&nbsp';
echo '<label class="col-8-md">';
echo '['.$row['sender_ids'].']';
echo '</label>';
echo '<div>';
?>
</div>
<div class="modal-footer">
<button id="submit_senderids" type="button" class="btn btn-primary" data-dismiss="modal">Submit</button><!--THIS BUTTON IS USED CALL JQUERY FUNCTION THAT UPDATES THE SENDERIDS_INPUT text box-->-->
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>

I was unable to find a similar issue on the internet. Please help to resolve this.

ricky0404
  • 1
  • 1
  • 1
    Where is `submit_senderids`? – Barmar Jan 12 '19 at 19:55
  • The submit_senderids is a checkbox list of options loaded from a database. I am adding the code. – ricky0404 Jan 13 '19 at 05:56
  • The information in post below resolved my issue. Turns out tokenfield adds a new input field or modifies the existing name to original_id-tokenfield. When I modified my id name to include '-tokenfield', it worked. https://stackoverflow.com/questions/33732795/disable-input-typing – ricky0404 Jan 13 '19 at 21:45
  • Nothing in the question mentions that you're using a library that modifies the DOM like that. – Barmar Jan 13 '19 at 22:46

0 Answers0