0
I have a page in PHP where I want to implement a Javascript alert for when the user clicks on the "Create a Call" menu to return a message to the user. I did the implementation using Alert(), but the alert returns when the page is updated and that’s not quite what I want Alert() to do on the page.
This is my PHP.
// Create ticket
if (Session::haveRight("ticket", CREATE)) {
$menu['create_ticket']['id'] = "menu2";
$menu['create_ticket']['default'] = '/front/helpdesk.public.php?create_ticket=1';
echo '<script type="text/javascript">alert("Retorne uma mensagem para o usuário ao clicar!");</script>';
$menu['create_ticket']['title'] = __s('Create a ticket')
$menu['create_ticket']['content'] = array(true);
}
Because the code exceeds the character limit I will post below the full code of the page.
Link: Complete Code
Page source code generated in HTML.
<!DOCTYPE html>
<html>
</script>
<a href="#" onclick="$('#loadbookmark').dialog('open');">
<img src="/glpi/pics/bookmark.png" title="Carregar um favorito" alt="Carregar um favorito" class="button-icon">
</a>
</li>
<li id="help_link">
<a href="http://glpi-project.org/help-helpdesk" target="_blank" title="Ajuda">
<img src="/glpi/pics/help.png" title="Ajuda" alt="Ajuda" class="button-icon">
</a>
</li>
</ul>
</div>
<div id="c_recherche"></div>
</div>
<div id="c_menu">
<script type="text/javascript">
alert("Retorne uma mensagem para o usuário ao clicar!");
</script>
<ul id="menu">
<li id="menu1"><a href="/glpi/front/helpdesk.public.php" title="Home" class="itemP">Home</a>
</li>
<li id="menu2"><a href="/glpi/front/helpdesk.public.php?create_ticket=1" title="Cria um chamado" class="itemP">Cria um chamado</a>
</li>
<li id="menu3"><a href="/glpi/front/ticket.php" title="Chamados" class="itemP">Chamados</a>
</li>
<li id="menu4"><a href="/glpi/front/reservationitem.php" title="Reservas" class="itemP">Reservas</a>
</li>
<li id="menu5"><a href="/glpi/front/helpdesk.faq.php" title="FAQ" class="itemP">FAQ</a>
</li>
</ul>
<script type="text/javascript">
< /html>
But I am not able to implement the function that calls the alert for only the item in this menu and not for the whole page. Could someone help?
What is the HTML of this "item" what do you mean? you can explain the question better?
– Sergio
Sergio! I added my HTML code to the question.
– Renato Lazaro
Renato, reopened. You can explain better what the user should do/click and what you would like to happen?
– Sergio
I want to click the menu2 on "Create called' the user to receive a text box message I used Alert() to try this procedure, but it returns to every page.
– Renato Lazaro