top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can I prevent onclick button from multiple click until it's confirmation from JavaScript if(confirm) condition.

+1 vote
648 views

How can i prevent onclick button from multiple click until it's confirmation from javascript if(confirm ) condition.

Note:-Solutions could be easy but not able to track because i am naive in UI development, please help me out.

Here is button

<input type="button" onclick="return saveValues();" value="<?php echo "values" ?>" class="silver_button_big">

Respective javaScript call

var saveValues = function() {
         // some code                
        if(isModified() == false){
            jError("It is modified.");
            return;
            }        
             if(confirm("Are you sure")){
              $.post(base_url + 'google/update_values', {
               //some code               
            }
    };
posted Sep 23, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Try something like this

File: myjs.js

my_toggle_var = 0; // your global variable which u can use to play 
function saveValues() {

    if (my_toggle_var  == 0)
    {
         // some code                
        if(isModified() == false){
            jError("It is modified.");
            return;
            }        
             if(confirm("Are you sure")){
              $.post(base_url + 'google/update_values', {
               //some code               
            }
        my_toggle_var  = 1; // You can move it up down based on your need....
    }
}; 

Let me know if this does not solve your problem.

answer Sep 23, 2014 by Salil Agrawal
+1 for the simplest solution Sir.
My Pleasure, Is this asked by you??
Similar Questions
+1 vote

I want the javascript API which could capture the screen of the client. Does anyone knows about it?

+3 votes

I went through this Discussion:

http://stackoverflow.com/questions/7087036/fetching-images-from-server-while-drawing-the-cell

I have a web server server-1.example.com. There is a JSON-Server running on another server server-2.example.com. What I have to achieve is to fetch a list of URLs (in form of JSON response) from server-2 and loop through the urls and fetch them from the server-1. In the meantime i have to animate these images on the browser by Fading the images one after the another.

The algorithm is something like this:-

START:
   FETCH the URLs from server-1 and store them in a cache C
   Loop until C.length
      Fetch first K images by forking a thread.
      animate k images
 END

How can I optimize K? Is my approach right?

0 votes

I want to add a menu to my application screens. The menu will have the menu icons which are horizontal scroll-able one menu at a time when left or right arrow pressed.

0 votes

<?xml version="1.0" encoding="utf-8" ?>
Assignment 2

var count;
// the number of value that you want to check if number or no
count=window.prompt("please enter value for count ");
var c;
c=parseInt(count);
if(!isNaN(c))
window.alert("The Value Is Number ! ");
else
{
window.alert("SorrY . The Value is Not Number (NaN ) ");
c=window.prompt(" NOT NUMBER ! \n please enter value for count ");
}
while(c<0)
{
c=window.prompt(" NEGATIVE NUMBER ! \n please enter value for count ");
if(!isNaN(c))
window.alert("The Value Is Number ! ");
else
{
window.alert("SorrY . The Value is Not Number (NaN ) ");
c=window.prompt(" NOT NUMBER ! \n please enter value for count ");
window.alert(" POSITIVE NUMBER ");
}}
document.writeln("GooD . The Value is Positive ");

...