1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XenForo.alert Has Transparent Background

Discussion in 'XenForo Development Discussions' started by Snog, Sep 11, 2013.

  1. Snog

    Snog Well-Known Member

    I'm trying to trigger the standard dropdown alert when a user clicks a link with this code...

    <a href="javascript:" onclick="XenForo.alert('{xen:phrase submission_received}','',3000);document.form.submit();" />{xen:phrase clickme}</a>
    It works, but for some reason the alert that drops down has a transparent background.

    Am I missing something here?
  2. digitalpoint

    digitalpoint Well-Known Member

    The background color is supposed to be transparent, but it's an image that causes the gradient looking thing... Maybe your image is missing?

    It should be here:

  3. Snog

    Snog Well-Known Member

    For a second I thought that was it, but the image is there. So, that's not the problem.
  4. digitalpoint

    digitalpoint Well-Known Member

    What is your site URL?
  5. Snog

    Snog Well-Known Member

    It's my offline development server. No access from the outside world.

    All other alerts show properly, it's just the one triggered by the JS that comes up transparent.
  6. digitalpoint

    digitalpoint Well-Known Member

    weird... works fine if I trigger that JS here or on my site.
  7. Snog

    Snog Well-Known Member

    I do believe that's because you aren't actually submitting the form.

    The full code looks like this..

    <form name="form" action="{xen:link threads/myfunction, $thread}" method="post" class="xenForm AutoValidator" data-redirect="on">
         <a href="javascript:" onclick="XenForo.alert('{xen:phrase submission_received}','',3000);document.form.submit();" />{xen:phrase clickme}</a>
         <input type="hidden" name="myvalue" value="1" />
         <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    If I break the submit by changing 'document.form.submit()' to 'document.form1.submit()' the alert works but obviously the form isn't submitted.

    If I leave it as is with the correct form name, the alert has the transparent background and the form is properly submitted.

    The reason I'm trying to use XenForo.alert is when you submit a form like this (using a link to submit the form), the standard php redirect with message doesn't display the message.
    Last edited: Sep 12, 2013
  8. Snog

    Snog Well-Known Member

    I've decided to take a different approach to this. So, a fix isn't needed unless someone wants to post one for reference.

Share This Page