1. #1
    Sencha User thejoker101's Avatar
    Join Date
    Mar 2007
    Posts
    348
    Vote Rating
    0
    thejoker101 is on a distinguished road

      0  

    Default Newline equivilent in Ext.MessageBox.alert()

    Newline equivilent in Ext.MessageBox.alert()


    In regular javascript alerts, you can pass in a '\n' character to make it break to the next line. However, in Ext.MessageBox.alert(), you can't have newlines or any html. Is this on purpose?

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    It's writing to innerHTML, so you can embed HTML elements. I justed tested with both
    and [b] and it works correctly.

  3. #3
    Sencha User thejoker101's Avatar
    Join Date
    Mar 2007
    Posts
    348
    Vote Rating
    0
    thejoker101 is on a distinguished road

      0  

    Default


    Yes, it is writing as innerHTML, however, it's also writing that inside a <span> tag, as opposed to a <div>. Since a span tag is supposed to be an inline only tag, you can't pass anything inside it that isn't also inline, such as a

    tag or a <ul> - both of which is what I would like to do.

  4. #4
    Sencha User thejoker101's Avatar
    Join Date
    Mar 2007
    Posts
    348
    Vote Rating
    0
    thejoker101 is on a distinguished road

      0  

    Default


    Anyone? It would be nice to have HTML inside of the alert.

  5. #5
    Sencha - Community Support Team JeffHowden's Avatar
    Join Date
    Mar 2007
    Location
    Forest Grove, OR
    Posts
    1,038
    Vote Rating
    1
    JeffHowden is on a distinguished road

      0  

    Default


    HTML is allowed inside the alert. I just updated the example to include
    tags inside one of the messages and it appropriately split the text onto multiple lines.

  6. #6
    Sencha User thejoker101's Avatar
    Join Date
    Mar 2007
    Posts
    348
    Vote Rating
    0
    thejoker101 is on a distinguished road

      0  

    Default


    Ok, let me rephrase then. The text that you specify to go into the alert gets pushed as innerHTML on a <span> tag. The <span> tag can only contain other inline elements like <abbr>, [b], or
    . So, I can't put any block-level html elements, such as

    or <ul> inside it.

  7. #7
    Ext User
    Join Date
    Mar 2007
    Posts
    32
    Vote Rating
    0
    Charles is on a distinguished road

      0  

    Default


    err... obviously you can, but you don't want to because span isn't supposed to have any block level elements inside it, right?

    I've always wondered about that... If you specify display of a span to be block (which is legitimate) are you supposed to treat it as inline or block in terms of allowed nesting elements? Can it still go inside another inline element?

    Why not another span with a style to display as block? Or list item?

  8. #8
    Sencha - Community Support Team JeffHowden's Avatar
    Join Date
    Mar 2007
    Location
    Forest Grove, OR
    Posts
    1,038
    Vote Rating
    1
    JeffHowden is on a distinguished road

      0  

    Default


    Well, in terms of valid code, I see your point Joker. However, as this as all generated on the fly, I hardly see the point. If it works, what's the worry?

    To answer your question Charles, I don't think that setting display to block changes the rules about what can be placed inside an inline tag. Rather, I think it only affects the actual behavior of the element.

  9. #9
    Ext JS Premium Member
    Join Date
    May 2009
    Posts
    72
    Vote Rating
    1
    UGA_Zimma is on a distinguished road

      0  

    Default


    I know this thread is old, but I am running into the same problem with Ext.messageBox. Can someone post code to show this working. <abbr> did not work for me.

    Thanks,

    UGA_Zimma

  10. #10
    Ext User
    Join Date
    Feb 2010
    Posts
    9
    Vote Rating
    0
    xjohny is on a distinguished road

      0  

    Default


    A little bit thread-ressurection:

    I tested <br /> and it works fine in all 4 major browser, tough it might not comply some HTML standards. I use it only for specific error messages, so I don't mind standards

Similar Threads

  1. MessageBox.alert
    By INeedADip in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 11 May 2007, 12:51 PM
  2. Only Alert Script from Message Dialogs
    By minoan in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 20 Mar 2007, 11:44 AM
  3. MessageBox alert and '\n'
    By cebola in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 13 Mar 2007, 5:25 AM
  4. Replace standart Alert dialog with ext.BasicDialog
    By Timoshka in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 29 Dec 2006, 11:52 AM
  5. YUI Evt Mgr oDR causes browser to alert "unsecure"
    By jay@moduscreate.com in forum Ext 1.x: Help & Discussion
    Replies: 13
    Last Post: 9 Dec 2006, 12:28 PM

Thread Participants: 5