NetTalk Central

Author Topic: Today's alert_div webinar question  (Read 3534 times)

mriffey

  • Newbie
  • *
  • Posts: 43
    • View Profile
    • Email
Today's alert_div webinar question
« on: May 07, 2015, 04:15:47 PM »
Today, Bruce and I were searching our memory banks during the NTWS webinar.

I thought I remembered that there was a way to have the code (below) update #alert_div (the red line on shoestrap) with the text in loc:alert, unhide the red line and NOT popup a message with the same text. I think Bruce also seemed to recall that used to exist in some form.

Code: [Select]
     loc:alert = 'blarg!'
     do SendMessage

Alas, our older brain cells were at the beach today, so we didn't recall what the cure is. I remember that on NTWS 6 (or maybe 7), this was a relatively simple matter, but many things have improved/moved/changed since then.

While you can certainly use

Code: [Select]
     p_web.Script('$(''#alert_div'').show();')
     p_web.Script('$(''#alert_div'').html(''Blarg'!');')

... this creates other work like hiding the div (and clearing the text) after some acceptable point in time - something that used to happen automatically in the olden days when html was carved from the tusk of a Amazonian piranha.

At least thats how I remember it:)

Mark

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Today's alert_div webinar question
« Reply #1 on: May 08, 2015, 02:05:32 AM »
Morning Mark,

I played around a bit, but I think that alert div on the browse is largely unused these days. It's mostly used by the page-mode-form.

That said, it's good to have a notification div, so I've added a bit of support for that back in.

p_web.showInfo('Message goes here')

you can also hide it with

p_web.hideInfo()

>> hiding the div (and clearing the text) after some acceptable point in time

I'm not sure it ever disappeared on a timer - I guess it disappeared when the error was corrected. However having it timeout is cool, so you can do

p_web.showInfo('Message goes here',timeout)

Where timeout is a long, normal clarion hundreths of a second, after which the message will fade away....

Lastly it defaults to the alert_div, but you could create any div you like on the page and use the same function;

p_web.showInfo('Message goes here',timeout,'mark_div')

and then if necessary

p_web.hideInfo('mark_div')

This is all in 8.48

Cheers
Bruce



mriffey

  • Newbie
  • *
  • Posts: 43
    • View Profile
    • Email
Re: Today's alert_div webinar question
« Reply #2 on: May 08, 2015, 02:41:08 PM »
All I have to say about that is that you should take the rest of the day off, cuz that seemingly little thing is awesome for the overall UX:)

Thanks Bruce, appreciate it.

Mark

PS: I agree, I dont think it was ever on a timer.