Text Input Submit Button

Hi I am using the text input with a submit button. I see that you can add HTML in the submit option. But when I tried to add a class attribute within the button html tag it embeds another button within the button. Is there a way to add a class attribute without adding the button tag or what am I doing wrong here?

Here is an example notebook.

Also how do I create my own validate function to make sure that they only submit a state? I couldn’t find an example with the validate option in the text input notebook.

1 Like

I guess the point is that you can specify any HTML that you want as the content of the button generated by Inputs.text You’ve specified your HTML to be another button so you get a button in a button. Perhaps, you should specify a DIV instead so that your submit line might look like:

submit: html`<div class="btn btn-outline-primary"> Submit </div>`

If you then have an HTML cell containing some CSS, you should see the effect. You might try:

  .btn {
    color: red !important

When using viewof, I’d usually do that while processing the result. So you might have a separate cell that looks like

  if( check(state)) {
   return good_output
  else {
    return warning