0
votes

how to create simple form using html service in gmail addon,i have struggle create forms, The below code i have tried,

login.html:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
<div class="gray-bg" style="min-height:100vh">

    <div class="middle-box text-center loginscreen animated fadeInDown" style="padding-top:20%">
        <div>
            <p>Login in. To see it in action.</p>
            <form name="login_form" class="m-t" role="form" >
                <div class="input-group m-b">
                    <span class="input-group-addon">
                        <i class="fa fa-home"></i>
                    </span>
                    <input type="number" class="form-control" name="clientId" placeholder="Id" required>
                </div>
                <div class="input-group m-b">
                    <span class="input-group-addon">
                        <i class="fa fa-user"></i>
                    </span>
                    <input type="text" class="form-control" name="username" placeholder="Username" required>
                </div>
                <div class="input-group m-b">
                    <span class="input-group-addon">
                        <i class="fa fa-lock"></i>
                    </span>
                    <input type="password" class="form-control" name="password" placeholder="Password" required>
                </div>
                <button  type="submit" class="btn btn-primary block full-width m-b">
                   Sign In
                </button>
                </form>
        </div>
    </div>
    </div>
  </body>
</html>

code.gs

var html_from_file = HtmlService.createTemplateFromFile('login').evaluate().getContent();
  return CardService.newCardBuilder()
  .setHeader(CardService.newCardHeader().setTitle('Login'))
  .addSection(CardService.newCardSection().addWidget(CardService.newKeyValue().setContent(html_from_file)))
  .build();

How to build the forms in gmail addon ??

Thanks in advance

1

1 Answers

0
votes

We can not create forms in gmail addon. Google team introduced new concept for UI using CardService. If you want to build a UI for gmail addon follow this quick tutorial: Tutorial