Solved

How to get my page to wait for input before proceeding

Posted on 2006-10-30
15
958 Views
Last Modified: 2008-01-09
Have the following code.  It presently goes immediately into the update process.   I would like for it to rather bring up a button that the user has to press to do the update.  I want the main screen to be a little tutorial which they can either read or they can press the update button to continue the client software push.  Thanks

<HTML>
<HEAD>

  <!--
  Comments on the 'JWalkX1' object.

  -->

<TITLE>CBJWalkX Update Home Page</TITLE>
</HEAD>
<BODY BACKGROUND="" bgcolors="#FFFFFF" link="#0000FF" vlink="#800080" top margin="0" leftmargin="0"
<p>




<BODY>

  <p>&nbsp;</p>
  <p align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <img border="0" src="msw-logo.gif" width="348" height="136"></p>




<P> This is the MSW JWalk Windows Client Updater. Please wait as the load process may take a minute.
<BODY>

  <OBJECT ID="JWalkX1" WIDTH=32 HEIGHT=32
    CLASSID="CLSID:E7C44C86-0CD3-11D2-9311-00A0247A4E65"
    CODEBASE="http://jwalkupdate.computerbodyguards.com/jwalkxs/jwalkx.cab#version=4,566,1,43">
    <PARAM NAME="Parameters" VALUE="/h192.168.1.1 http://jwalkupdate.computerbodyguards.com/jwalkapp/example/example.jwc /M2924 /GMAIWS=2">
    <PARAM NAME="ClientLocationSetup" VALUE="http://jwalkupdate.computerbodyguards.com/jwalkxs/jwalkxs.exe">
    <PARAM NAME="RequiredVersion" VALUE="Version 4.0C11.1.43">
    <PARAM NAME="IndependentWindow" VALUE="NO">
    <PARAM NAME="StartSession" VALUE="YES">

    <!--
    <PARAM NAME="UseMainPanelSizeAsDefault" VALUE="NO">
    <PARAM NAME="silentClientInstallDirectory" VALUE="C:\Program Files\SEAGULL\J Walk Windows Client">
    <PARAM NAME="clientInstallModeSilent" VALUE="NO">
    <PARAM NAME="silentClientFilesToInstall" VALUE="http://jwalkupdate.computerbodyguards.com/jwalkxs/jwalkxs.cab">
    <PARAM NAME="silentClientProgramFolderName" VALUE="C:\Program Files\SEAGULL\J Walk Windows Client">
  -->

<SCRIPT LANGUAGE="JavaScript">
<!-- Hide script for older browsers
var xpiFile = "http://jwalkupdate.computerbodyguards.com/jwalkxs/jwalkp.xpi";
var xpiVersion = "4.566.1.43";
var pluginRegName = "Seagull J Walk Client Plugin v4.566.1.43";
var packageName = "plugins/jwalkx";
var jarFile = "http://jwalkupdate.computerbodyguards.com/jwalkxs/jwalkp.jar";

var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav6up = (is_nav && (is_major >= 5));

if(navigator.appName == "Netscape")
  {
  if (navigator.platform == "Win32")
    {
    if (is_nav6up )
      {
      doXPInstall();
      }
    else if ( is_nav4up )
      {
      doJARInstall();
      }
    else
      {
      var newWin = window.open("http://jwalkupdate.computerbodyguards.com/jwalkxs/upgrade.html", "UpdatePopUp", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=460,height=500');
      }
    }
  else
    {
    alert("This plugin requires Windows NT/9x or greater.");
    }
  }

function doXPInstall()
{
 if (InstallTrigger.updateEnabled())
 {
  var installed_version = InstallTrigger.getVersion(packageName);
  var is_new_plugin = ((installed_version == null)
            || (InstallTrigger.compareVersion(packageName,xpiVersion) < 0)
            || (!navigator.plugins[pluginRegName]));

  if(is_new_plugin)
   {
    var xpiInstallation = new Object();
    xpiInstallation[pluginRegName] = xpiFile
    InstallTrigger.install(xpiInstallation, xpinstallCallback);
   }
 }
 else
  {
  alert("Please enable the software installation and resume this operation.");
  }
}

function xpinstallCallback(url,status)
{
  if(status == 0 || status == 999 )
    {
    alert("Please, restart the browser to complete the installation process.");
    }
  else if(status != 0 && status != 999 )
    {
    alert("Install FAILED with error: " + status);
    }
}

function doJARInstall()
{
if ( navigator.javaEnabled() )
  {
  trigger = netscape.softupdate.Trigger;
  if ( trigger.UpdateEnabled() )
    {
    vi = new netscape.softupdate.VersionInfo(4,566,1,43);
    installed_version = trigger.GetVersionInfo(packageName);
    if (installed_version == null || installed_version.compareTo(vi) < 0 || !navigator.plugins[pluginRegName])
      {
      trigger.ConditionalSoftwareUpdate(jarFile,packageName, vi, trigger.FORCE_MODE);
      }
    }
  else
    {
    alert("Enable SmartUpdate before running this script.");
    }
  }
else
  {
  alert("Enable Java before running this script.");
  }
}
// -->
</SCRIPT>
<p><embed WIDTH=640 HEIGHT=488 TYPE="application/x-jwalkx"
Parameters="/h192.168.1.1 http://jwalkupdate.computerbodyguards.com/jwalkapp/example/example.jwc /M2924 /GMAIWS=2"
IndependentWindow="NO"
RequiredVersion="Version 4.0C11.1.43"
StartSession="YES"
ClientLocationSetup="http://jwalkupdate.computerbodyguards.com/jwalkxs/jwalkxs.exe"
silentClientInstallDirectory="C:\Program Files\SEAGULL\J Walk Windows Client"
clientInstallModeSilent="NO"
silentClientFilesToInstall="http://jwalkupdate.computerbodyguards.com/jwalkxs/jwalkxs.cab"
silentClientProgramFolderName="C:\Program Files\SEAGULL\J Walk Windows Client"></p>
</EMBED></OBJECT>
</BODY>
  <p>If you see the following at the top of your browser, please click on it:</p>
  <p><img border="0" src="activx_control_msg_top.GIF" width="703" height="150"></p>
</BODY>
</HTML>
0
Comment
Question by:jjackson2004
15 Comments
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 17835471
Use confirm   or  prompt (if you need additional user inputs).



e.g

<script language="javascript">

var conf = confirm ("Continue");
if (!conf) { alert ('I do not want to Continue'); }

</script>
0
 

Author Comment

by:jjackson2004
ID: 17835713

Need more information.   First question is where do you put it on the page in relation to the other scripts.  Would prefer it to be an "Update" button that they press whenever and only active if the popup came up telling the user that they need to update.
0
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 17836381
Here is a example for you.

A form is filled, when ever user changes any text, he is alerted about the changes, and
then prompted to confirm, if he likes to continue..




Please try this one.

<html>
<head>
<title>Form Confirm Document</title>
</head>

<body>
<script language="javascript">
var formFlds=null;
function formFldData (fld) {
   this.name = fld.name;
   this.value = fld.value;
}
function SaveChanges(theForm) {
   formFlds = new Array();
   if (!theForm) { return false; }
   for (var ix=0; ix < theForm.elements.length; ix++) {
         formFlds[ix] = new formFldData(theForm.elements[ix]);
   }
}

function FindFld (fld) {
   var str = null;
   if (!fld) { return; }
   for (var ix=0; ix < formFlds.length; ix++) {
         if (!fld.name) { continue; }
         if (!formFlds[ix].name) { continue; }
       if (exactMatch(fld.name,formFlds[ix].name)) {
            if (!exactMatch(fld.value,formFlds[ix].value)) {
                str = '\n Field Name:' + fld.name + '\n    New Value:' + fld.value + '\n    Old Value:' + formFlds[ix].value;
                break;
            }
         }
   }
   return str;
}
function exactMatch(s1, s2) {
   if (!s1) { return false; }
   if (!s2) { return false; }
   if (s1.length == s2.length) {
      if (s1.match(s2) && s2.match(s1)) { return true; }
   }
   return false;
}
function CheckChanged(theForm) {
      var changed = false;
    if (!theForm) { return changed; }
    var msgStr = '';
    for (var ex=0; ex < theForm.elements.length; ex++) {
       var str = FindFld (theForm.elements[ex]);
       if (str) {
               changed = true;
                  msgStr += str;
            }
    }
    if (changed) {
            msgStr = 'Following fields are changed\n' + msgStr;
    }
    else {
            msgStr = 'Nothing is changed\n';
    }
      alert (msgStr);
    return changed;    
}
function submitForm(theForm) {
if (CheckChanged(theForm)) {
      var conf = confirm ('Field Values changed, You want to continue');
      if (!conf) { return false; }
}
return true;
}
</script>
<form name="MyForm"  method="get" onsubmit="return submitForm(this);">
<br>First Name:<input type="text" name="firstname"  value="FIRSTNAME">
<br>Last Name:<input type="text" name="lastname" value="LASTNAME">
<br><input  type="reset" value="Reset"><input  type="submit" value="Submit Form">
</form>
<script language="javascript">
if (document.MyForm) { SaveChanges(document.MyForm); }
</script>
</body>
</html>
0
 

Author Comment

by:jjackson2004
ID: 17839280
Looks good, but not what I need.  

I need the script to check for the version number to run.  If it finds a version update is needed, then set a logical value.  This logical is used to set the update button active or inactive.  If an update is not needed, then popup and say no update is needed.  If an update is needed then the update button needs to be active.  When the update button is pressed, then the other javascripts need to execute.
0
 
LVL 28

Accepted Solution

by:
Pravin Asar earned 175 total points
ID: 17845132
If I understood correctly based on your last post..

If you have a some value set , and based on that value you want to

1. Have Update button active.
2. On click on "Update" button, run a particular script

Try this one..

<html>
<script language="javascript">
var updateValue = "1.5";
function RunUpdateScript () {
alert ('Update Script runs now');
}
function SetUpdateBtn () {
   document.getElementById ('updateBtn').disabled = false;
   if (updateValue == "2.0") {
        document.getElementById ('updateBtn').disabled = true;
   }
}
</script>
<body onload="SetUpdateBtn();">
<form>
<input id="updateBtn" type="button" value="Update" onclick="RunUpdateScript();">
</form>
</body>
</html>
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:jjackson2004
ID: 17858175
Added some more points.  Now can you show me where you would put your examples in the original code?
0
 

Author Comment

by:jjackson2004
ID: 18019275
Have not abaondoned this issue yet.  Just became sidetracked.   Back to being an active issue for me.
0
 
LVL 17

Expert Comment

by:cem_turk
ID: 18517043
@jjackson2004 you should post pointer questions if you still want to find a solution otherwise nobody is interested in it in this situation, so please post pointer questions or ask mods to close this question in the community support area, thanks.
0
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 18522921
cem_turk
EE Cleanup Volunteer

Thanks for trying chase such abaondoned issues.

If jjackson2004 , does not want to close this one.

Refund the point to him and close the question.


0
 

Author Comment

by:jjackson2004
ID: 18523264
What is a pointer question?  This question has 350 points offered.  Are you stating that I should increase the point amount?  I have many projects going.  This one was sidetracked for a while, but it is not abandoned.

Or are you stating that my question is too broad and needs to be more focused?

0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 175 total points
ID: 18964314
This is a very old question

I think what you want is to take this out of the code

if(navigator.appName == "Netscape")
  {
  if (navigator.platform == "Win32")
    {
    if (is_nav6up )
      {
      doXPInstall();
      }
    else if ( is_nav4up )
      {
      doJARInstall();
      }
    else
      {
      var newWin = window.open("http://jwalkupdate.computerbodyguards.com/jwalkxs/upgrade.html", "UpdatePopUp", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=460,height=500');
      }
    }
  else
    {
    alert("This plugin requires Windows NT/9x or greater.");
    }


and put it in a new function

function doIt() {

if(navigator.appName == "Netscape")
  {
  if (navigator.platform == "Win32")
    {
    if (is_nav6up )
      {
      doXPInstall();
      }
    else if ( is_nav4up )
      {
      doJARInstall();
      }
    else
      {
      var newWin = window.open("http://jwalkupdate.computerbodyguards.com/jwalkxs/upgrade.html", "UpdatePopUp", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=460,height=500');
      }
    }
  else
    {
    alert("This plugin requires Windows NT/9x or greater.");
    }

}


and then add to the page:

<form><input type="button" onClick="doIt()" value="Click to Upgrade now"></form>

Michel
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now