Solved

convert VB to javascript

Posted on 2011-09-15
7
565 Views
Last Modified: 2012-05-12
Is it possible to convert this VB script to javascript?  This code works behind a button on a .net application.

Just wanted to see if javascript might make it more browser compliant
<table id="tblReqField" class="Form"> <tr class="SectionHeader"><TH>Actions</TH></TR></TABLE>

<button class="exButton" language="VBS" onclick="DoSomething()">Schedule appointment</button>

<script language="VBS">

Sub DoSomething()

   window.location = "WflRequest.aspx?CopyFields=1;2;30;31;91;&BCAction=0&Type=6011&CopyFrom=" & frmMain.RequestID.Value

End Sub

</script>

Open in new window

0
Comment
Question by:red_75116
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 250 total points
ID: 36546450
<table id="tblReqField" class="Form"> <tr class="SectionHeader"><TH>Actions</TH></TR></TABLE>

<button class="exButton" onclick="DoSomething()">Schedule appointment</button>

<script language="javascript" type="text/javascript">

function DoSomething() {
   window.location.href = "WflRequest.aspx?CopyFields=1;2;30;31;91;&BCAction=0&Type=6011&CopyFrom=" + document.getElementsByName("RequestID")[0].value;
}

</script>

Open in new window

0
 

Author Comment

by:red_75116
ID: 36546542
thanks!  that works, but I was hoping to get this to work in chrome and possibly firefox but it doesn'.  Any ideas how to make work in other browsers??
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36546568
it should work on all
do you have a link to see your page?
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 

Author Comment

by:red_75116
ID: 36546585
it works fine in IE, but flashes the page, but doesnt open the link in Chrome.  Haven't downloaded FF yet to try.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36546604
let me see that in live

unactive your popup blocker
0
 

Author Comment

by:red_75116
ID: 36546610
it could be my app not your code

found this error in chrome
Failed to load resource: the server responded with a status of 400 (Bad Request)

0
 
LVL 82

Accepted Solution

by:
hielo earned 250 total points
ID: 36547235
try:
<script type="text/javascript">

function DoSomething()
{
   window.location.href = "WflRequest.aspx?CopyFields=1;2;30;31;91;&BCAction=0&Type=6011&CopyFrom=" + document.frmMain.RequestID.value;

}

</script>


NOTE: Unlike VBScript, Javascript IS case sensitive. Thus, due to:
document.frmMain.RequestID.value;

your HTML should have:
<form name="frmMain"...>

but NOT <form name="FrmMain"...> (notice the capital "F").  To javascript, frmMain and FrmMain are different.

The same goes for the other input - you should have:
<input name="RequestID" ...>

IF your markup is different, then adjust the javascript line accordingly - in other words, if you have:

<form name="FRMMain"...>
<input name="requestID" ...>

then you should use this instead:
document.FRMMain.requestID.value;

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article discusses how to implement server side field validation and display customized error messages to the client.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

691 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