Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to display data in Table format in BOT #2785

Closed
MuraliMohanEdiga opened this issue May 18, 2017 · 9 comments
Closed

[Question] How to display data in Table format in BOT #2785

MuraliMohanEdiga opened this issue May 18, 2017 · 9 comments
Assignees
Labels
customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete.

Comments

@MuraliMohanEdiga
Copy link

Hi,

Can some one please help me out in displaying the data table format in BOT as below

table

@nwhitmont
Copy link
Contributor

@MuraliMohanEdiga Are you using .NET or Node SDK for BotBuilder?

@nwhitmont nwhitmont changed the title How to display data in Table format in BOT [Question] How to display data in Table format in BOT May 18, 2017
@stevengum
Copy link
Member

@MuraliMohanEdiga which channel are you trying to create a table on?

@nwhitmont
Copy link
Contributor

To display a table in your message, set your message textFormat property to xml and use a HTML string as your message text.

Example (Node SDK):

bot.dialog('message_with_table', function (session) {
    var tableHTML = '<table style="padding:10px;border:1px solid black;"><tr style="background-color:#c6c6c6"><th>Countries</th><th>Capitals</th><th>Population</th><th>Language</th></tr><tr><td>USA</td><td>Washington D.C.</td><td>309 million</td><td>English</td></tr><tr><td>Sweden</td><td>Stockholm</td><td>9 million</td><td>Swedish</td></tr></table>';
    var message = {
        type: 'message',
        textFormat: 'xml', 
        text: tableHTML
    };
    session.send(message);
});

@nwhitmont nwhitmont added the customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. label May 18, 2017
@MuraliMohanEdiga
Copy link
Author

@nwhitmont ..Its working for me to display data in table format. Thank you so much

@MuraliMohanEdiga
Copy link
Author

MuraliMohanEdiga commented May 22, 2017

Hi @nwhitmont

Thanks for your reply about displaying the data in table format .With reference to the syntax provided I am trying to create login(html) form in the BOT ,I am able to create the form with some html controls like text boxes(input fields) please find the screenshot given below.

Can you please let me know how to retrieve the values of the form fields(text boxes/Password fields) created in the bot.

Please find the sample snippet

capture1

var message = {
    type: 'message',
    textFormat: 'xml', 
    text: tableHTML
};
session.send(message);
session.endDialog();

}

]).triggerAction({
matches: [/representative form/i, /loginform/i]
});

function check(form) { /*function to check userid & password*/
            /*the following code checkes whether the entered userid and password are matching*/
            if(form.userid.value == "myuserid" && form.pswrd.value == "mypswrd") {
			alert("success")
                //window.open('target.html')/*opens the target page while Id & password matches*/
            }
            else {
                alert("Error Password or Username")/*displays error message*/
            }
        }

capture

@himanshujain12221
Copy link

hi.. did you get proper table format in slack bot? I am also looking for a similar option. it would be great if you can share your suggestions.

@karuneshgurkar10
Copy link

karuneshgurkar10 commented Oct 12, 2017

hi..can you please tell how to display table in bot by .NET SDK

@ghost
Copy link

ghost commented Oct 18, 2017

yeah, it will be helpful, anybody sends code to display table in bot by .NET SDK

@kushalnawalakha
Copy link

I tried to set
IMessageActivity message = Activity.CreateMessageActivity();
message.TextFormat = "xml";
but that didnt work, anyone has any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete.
Projects
None yet
Development

No branches or pull requests

6 participants