1

I'm trying to insert the select options tag into my conversation, to make it more simple to the user. I did this:

Conversation

And in the index.js:

function selected(){
switch($('#selected option:selected').val()){
    case 01:
       alert("01");
        break;
    case 02:
        alert("02");
        break;
}
};

But it doesn't recognize the option selected. I tried without the function selected() (only with switch case), but it didn't worked.. Can somebody help me please? Thanks a lot!

barbs
  • 172
  • 1
  • 9
  • Can you answer to my question connected to your problem here ([https://stackoverflow.com/questions/46787117/how-to-create-a-form-builder-with-watson-conversation-dialog](https://stackoverflow.com/questions/46787117/how-to-create-a-form-builder-with-watson-conversation-dialog)) ? – Paolo David Oct 17 '17 at 10:10

1 Answers1

1

I believe your HTML inside the Advanced context have something you miss.

In your HTML in onselect your typed :, but, for use onselect and call one function you have to use onselect="nameFnction()"

See one simple example inside MDN to use this tag:

<input type="text" onselect="myFunction()" value="Hello world!">

Now, see other example for works fine according the choice:

<select>
  <option onclick="doSomethingA(this);">A</option>
  <option onclick="doSomethingB(this);">B</option>
  <option onclick="doSomethingC(this);">C</option>
</select>

And with jQuery (Your id is select and not selected):

$('#select option:selected').val()
Community
  • 1
  • 1
Sayuri Mizuguchi
  • 5,250
  • 3
  • 26
  • 53
  • Hi Sayuri, I am trying to implement date picker in my IBM watson dialog response. I know that HTML code could be inserted as TEXT in response but how I am not able to figure out. Please help me out with some code snippet. I am not a UI person too. – Kumar Apr 14 '20 at 08:26
  • Hi @Kumar, that would be a different question and with some updates that Watson Assistant had in the past months. I would advise you to create a new Question. You can ping me – Sayuri Mizuguchi Apr 14 '20 at 14:39
  • Yes, I created one new question. Please have a look. https://stackoverflow.com/questions/61204579/use-html-date-picker-in-ibm-watson-conversation-dialog-to-get-date-as-input-from?noredirect=1#comment108277496_61204579 – Kumar Apr 14 '20 at 15:02
  • Thank U for time. – Kumar Apr 14 '20 at 15:02