Correct way to call a URL on button click

So, I wrote a Java servlet to get a zip file from the server which works fine when I use a web browser to test it.

My URL looks like the following :

This successfully downloads the files.

I’ll be dynamically passing the UUID part of the filename (which I’ll get from the database table(top most) record) and user variables but for the time being and testing, I’ve hard coded these variables.

I am wondering how should I call the above URL when a user clicks on a button. My current setup (without any URL) is as follows.

I’ve button in my HTML code as shown below:

<button id="fileButton" onclick="checkFile()">Download Files</button>

<script> function checkFile(){  }  </script> 

Is following a correct way to do it?

<button id="fileButton" onclick="checkFile(); location.href= ">Download Files</button>

So even if above approach is correct, it is very likely that the file won’t be available for download as soon as user hits download button.

I might have to keep running the above URL again and again (this may not be possible in a scenario if I tie the URL with the button click), maybe using setInterval() method of javascript which could only be possible to do inside a function.

How do I solve this problem where I get ‘unable to locate the element’ error when trying to click on a button that expands on click

I’m trying to click on a button that expands on click but selenium is unable to locate the element. The element identified seems to be correct.

I tried to first simply find the element and click on it and then also tried to use ActionChains. Tried changing the element value and the methods of identifying such as ID, XPath, CSS Selector but nothing seems to work.

<tr style="border-top:1px solid #e6e6e6;"><td style="display:inline-block;"><div class="expand"><i id="expand_2971740_2086074" class="fa fa-plus-circle" onclick="" style="display: block;"></i><i style="display: none;" id="collapse_2971740_2086074" class="fa fa-minus-circle" onclick="closeBundleCourses(2971740,2086074)"></i></div></td><td class="text-center">Course1Jan</td><td class="text-center">19-06-2019</td><td class="text-center">0</td><td class="text-center">1</td></tr>

click_plus_button = 'expand_2971740_2086074' #id  def __init__(self,driver):         self.driver = driver      def enroll_user(self,firstname,lastname,email):         self.driver.find_element_by_link_text(self.go_to_manage_users).click()         self.driver.find_element_by_class_name(self.expand_manage_users).click()  time.sleep(2) actions = ActionChains(self.driver) actions.move_to_element(self.driver.find_element_by_id(self.click_plus_button)).click().perform()          self.driver.find_element_by_id(self.manage_users_firstname).send_keys(manage_users_firstname)         self.driver.find_element_by_id(self.manage_users_lastname).send_keys(manage_users_lastname)         self.driver.find_element_by_id(self.manage_users_email).send_keys(manage_users_email)  

Expected Result Expected Result

Actual Result: Actual Result

click here >>>

Centaur Male Enhancement to have a bigger one mainly.The popular outcomes that average male can go out of doors of enlargement critiques can involve progressed erections. Contains not simplest getting large erections furthermore getting erections that simple to start and hold after a piece. The fact those styles of erections are more difficult in intensity makes all of those books the more beneficial for every…

click here >>>

UI to select different tools for right and left click

I’m working a specialized paint web application (for designing Minecraft structures). I would like for the user to be able to assign different tools to the left and right mouse buttons. (I don’t intend to override the default right-click behavior other than this.)

I have a traditional tool palette. I’ve been experimenting with a way to indicate that the user has selected one tool for the left mouse button and another tool for the right mouse button:

enter image description here

The left and right tool indicators are differentiated in three ways:

  • Position (left vs right)
  • A tiny L or R.
  • Contrasting (though meaningless) colors.

In order to select a tool, the user clicks on the tool icon with either the left or right mouse button, and that button will be bound to that tool.

The right-click tool functionality is (very) convenient, but not essential. Users who can’t or don’t want to right-click can use the left button exclusively. In addition, when the cursor is over the canvas, then the appropriate cursor icon for the left tool will be displayed unless the user is actively using the right tool.

Does this UI make sense? I’m not nearly at the stage of user testing yet, but I wanted a sanity check because I don’t think I’ve seen this pattern before. An alternative would be to have a separate tool palette for right clicking, but I’m concerned that this could be confusing and inconvenient.

evento click en tabla dinamca

amigos si alguien puede ayudarme.. estoy empezando en a trabaja con jquery, obviamente antes me e documentado pero estoy en un problemita que se que ustedes que dominan esta libreria les parecera muy sencillo de ante mano agradezco su ayuda.. les planteo:

  1. bien tengo una tabla dinamica cargada la cual me genera los td, y dentro estos td tengo un input text, y 2, a y dentr de estas a tengo unas img.
  2. cuando presione una de estas a sea + ó – me sume +1 ò -1.
  3. con el metodo this me funciona muy bien la operacion siempre que hago el evento click sobre el input text.
  4. pero yo lo deseo es cuando ocurra en la a dependiendo sea + ò -.
  5. mi logica me dice que estoy haciendo mal la seleccion, pero de verdad que lo e intentado y no logro hacerlo.
  6. o quizas tengo problemas con las clases de los elementos que deseo selecionar.
  7. la tabla la estoy mostrando en un div que llame con la clase datos.
  8. cuando presiono el boton + en el primero que haga click me lo va incrementando perfecto, pero al hacer click en otro + de otra td toma el valor del primero y le suma +1 nada mas ejemplo (si el primero sumo hasta 6 cuando presiono el + del proximo td lo incremnta a 7).
  9. estoy siendo lo mas explicito posible de acuerdo a las reglas del foro espero me puedan ayudar.n
  10. de igual manera les dejo fragmeto de los codigos..

esta es la tabla “no coloco el codigo competo solo lo que en este momento se nesecita para el analisis”

while($  fila = $  resultado->fetch_assoc()){   //  echo "<a href=\"#\"><img src='imagenes/" . $  fila['imagen'] . "'></a>";     $  salida.="<tr>                <td>".$  fila['codigo']."</td>                 <td>".$  fila['descripcion']."</td>                 <td>".$  fila['disponible']."</td>                 <td>".$  fila['unidad']."</td>                 <td>".$  fila['precio']."</td>                 <td> <input type='text' name='quantity' class='quantity' id='quantity' value='1'>                 <a id='plus' class='plus' name='plus' style='cursor:pointer;'><img src='iconos/add.png'> </a>                <a id='min' class='min' style='cursor:pointer;'><img src='iconos/menos.png'> </a></td>                  <td>  <a href='facturanuevadetalle.php?id=".$  fila['id']."&codigo=".$  fila['codigo']."'>  <button type='button'  class='ver'> <img src='iconos/carrito-mas.png'></button> </a> </td>               </tr>";     

$ (document).ready(function(){ $ (‘.datos’).find(‘a’).on(‘click’, function(evento){

$  (this).siblings('input').val(parseInt($  ('.quantity').val()) + 1);  }); }); 

click here>>>

click here>>>

SharePoint InfoPath display form – how to open in edit mode after button click

I have created a display form in InfoPath for a SharePoint list.

On the display form I have a visible control image button called ‘Edit’.

When I click the button in display mode I switch to another view.

The problem is the new view is opening in display mode and not edit mode.

How can I control what mode the new view is opening in when the ‘edit button’ is clicked?

Best regards Morten

How can I make my js app run using one “on click event” instead of four?

I’m a few weeks into javascript and had to make a simple “crystals collector” app. The app works as intended, but the code is obtuse and repetitive.

I’d like to make the app work using just one on click event, rather than using four for each crystal. I can’t make an array of each color crystal and loop through them since the num variables change as well.

Sorry for such a rudimentary question, thanks for any advice.

Here is my code below:

$  (document).ready(function () {      // Global variables          var targetNumber;     var num1;     var num2;     var num3;     var num4;     var userTotal = 0;     var wins = 0;     var losses = 0      // Functions      function reset() {         num1 = Math.floor(Math.random() * 11 + 1);         num2 = Math.floor(Math.random() * 11 + 1);         num3 = Math.floor(Math.random() * 11 + 1);         num4 = Math.floor(Math.random() * 11 + 1);         targetNumber = Math.floor(Math.random() * 101 + 19);         userTotal = 0;         $  ("#total-score").text(userTotal);         $  ("#target-score").text(targetNumber);     }      function initialize() {         num1 = Math.floor(Math.random() * 11 + 1);         num2 = Math.floor(Math.random() * 11 + 1);         num3 = Math.floor(Math.random() * 11 + 1);         num4 = Math.floor(Math.random() * 11 + 1);         targetNumber = Math.floor(Math.random() * 101 + 19);         $  ("#target-score").text(targetNumber);         $  ("#wins").text(wins);         $  ("#losses").text(losses);         $  ("#total-score").text(userTotal);     }     function logic() {         if (userTotal === targetNumber) {             alert("You Win!");             reset();             wins++;             $  ("#wins").text(wins);         }         else if (userTotal > targetNumber) {             alert("You lose!");             reset();             losses++;             $  ("#losses").text(losses);         }     }      // Run Game (main)     // something like...     // var array = ["#blue","#green","#red","#yellow"]     // for (var i =0; i < array.length;i++) {     // }      initialize();      $  ("#blue").on("click", function () {         userTotal = userTotal + num1;         $  ("#total-score").text(userTotal);         console.log(userTotal);         logic();     })      $  ("#green").on("click", function () {         userTotal = userTotal + num2;         $  ("#total-score").text(userTotal);         console.log(userTotal);         logic();     })      $  ("#red").on("click", function () {         userTotal = userTotal + num3;         $  ("#total-score").text(userTotal);         console.log(userTotal);         logic();     })      $  ("#yellow").on("click", function () {         userTotal = userTotal + num4;         $  ("#total-score").text(userTotal);         console.log(userTotal);         logic();     })    });
.img {     width: 150px;     height: 150px; }  #crystal-main {     width: 650px;     border: 2px solid gray;     padding: 25px;     background: black;     color: whitesmoke; }
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <meta http-equiv="X-UA-Compatible" content="ie=edge">     <link rel="stylesheet" href=""         integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">     <link rel="stylesheet" href="assets/css/style.css">     <title>Crystal Game</title>     <script type="text/javascript" src=""></script>     <script src="assets/javascript/game.js"></script> </head>  <body>     <h1>Crystals Collector!</h1>     <hr>     <div class="container-fluid">         <div class="container" id="crystal-main">             <div class="row">                 <h2>Target Score: <span id="target-score"></span></h2>             </div>             <div class="row">                 <h2>Total Score: <span id="total-score"></span></h2>             </div>             <div class="row">                 <div class="col-3-md crystal">                     <img src="assets/images/blue.png" alt="blue" class="img" id="blue">                 </div>                 <div class="col-3-md crystal">                     <img src="assets/images/green.png" alt="green" class="img" id="green">                 </div>                 <div class="col-3-md crystal">                     <img src="assets/images/red.png" alt="red" class="img" id="red">                 </div>                 <div class="col-3-md crystal">                     <img src="assets/images/yellow.png" alt="yellow" class="img" id="yellow">                 </div>             </div>             <div class="row">                 <h4>Wins: <span id="wins"></span></h4>             </div>             <div class="row">                 <h4>Losses: <span id="losses"></span></h4>             </div>         </div>     </div>  </body> </html>