Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

convert VB to javascript

Posted on 2011-09-15
7
Medium Priority
?
573 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
  • 3
  • 3
7 Comments
 
LVL 83

Assisted Solution

by:leakim971
leakim971 earned 1000 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 83

Expert Comment

by:leakim971
ID: 36546568
it should work on all
do you have a link to see your page?
0
Industry Leaders: 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!

 

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 83

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 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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…
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…
Suggested Courses
Course of the Month21 days, 4 hours left to enroll

810 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