microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Samples/Samples.Dialogs/Web/dialog-form/index.html
41lines · modecode
| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Microsoft Teams Task Module Demo</title> |
| 5 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> |
| 6 | <script src="https://statics.teams.cdn.office.net/sdk/v1.11.0/js/MicrosoftTeams.min.js"></script> |
| 7 | <style> |
| 8 | body { margin: 0; padding: 10px; } |
| 9 | .form-group { margin-bottom: 10px; } |
| 10 | </style> |
| 11 | </head> |
| 12 | <body> |
| 13 | <div class="container"> |
| 14 | <form id="customForm"> |
| 15 | <div class="form-group"> |
| 16 | <label>Name:</label> |
| 17 | <input type="text" class="form-control" id="name" name="name" required> |
| 18 | </div> |
| 19 | <div class="form-group"> |
| 20 | <label>Email:</label> |
| 21 | <input type="email" class="form-control" id="email" name="email" required> |
| 22 | </div> |
| 23 | <button type="submit" class="btn btn-primary">Submit</button> |
| 24 | </form> |
| 25 | </div> |
| 26 | |
| 27 | <script> |
| 28 | microsoftTeams.initialize(); |
| 29 | |
| 30 | document.getElementById('customForm').addEventListener('submit', function(event) { |
| 31 | event.preventDefault(); |
| 32 | let formData = { |
| 33 | name: document.getElementById('name').value, |
| 34 | email: document.getElementById('email').value, |
| 35 | submissiondialogtype: 'webpage_dialog' |
| 36 | }; |
| 37 | microsoftTeams.tasks.submitTask(formData); |
| 38 | }); |
| 39 | </script> |
| 40 | </body> |
| 41 | </html> |