Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASPX HTML code to call another ASPX

Posted on 2015-01-21
21
Medium Priority
?
90 Views
Last Modified: 2015-01-26
I have a simple ASP/HTML need that I need help with
 
In a sharepoint environment I need a simple page that has an input value and when the submit button is clicked it initiates the execution of another link.

Here is the Variable code

            <td style="width: 20%" class="style1">Enter the opportunity ID:</td>
            <td><span class="style2"><span class="style3">
            <input name="tOppID" type="text" value="OPP-" style="width: 147px" /></span></span>&nbsp;</td>

And here is the submit button code

            <td style="width: 20%" class="style1">
            <input name="Submit1" type="submit" value="submit" /></td>
            <td>&nbsp;</td>

When the user enters something in the tOppID field and then Clicks Submit I want it to execute the following:
http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffing.aspx?Param1=(tOppID)
0
Comment
Question by:Matt Pinkston
[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
  • 11
  • 10
21 Comments
 
LVL 34

Expert Comment

by:Big Monty
ID: 40562712
first, add an ID to your input field:

<input name="tOppID" id="tOppID" type="text" value="OPP-" style="width: 147px" />

for your submit button, add a call to a javascript function:

<input name="Submit1" type="submit" value="submit" onclick="doSubmit(); />

then your javascript function would look like:

function doSubmit() {
    var url = 'http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffing.aspx?';
    var param = document.getElementById('tOppID').value;

   if( param != '' ) {
      url += 'Param1=' + param;
      document.forms[0].action = url;
     document.forms[0].submit();
   }
}
0
 

Author Comment

by:Matt Pinkston
ID: 40562732
where do I put the javascript?

in header just like

function doSubmit() {
     var url = 'http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffing.aspx?';
     var param = document.getElementById('tOppID').value;

    if( param != '' ) {
       url += 'Param1=' + param;
       document.forms[0].action = url;
      document.forms[0].submit();
    }
 }
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 40562740
anywhere in your <HEAD> tags is fine
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:Matt Pinkston
ID: 40562757
Does it have to be wrapped with anything?
0
 

Author Comment

by:Matt Pinkston
ID: 40562771
is this missing something?

<input name="Submit1" type="submit" value="submit" onclick="doSubmit();/>
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 40562781
you need to specify the fact that it's javascript, so your complete code in your <HEAD> tag would be:

<script type="text/javascript">
function doSubmit() {
     var url = 'http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffing.aspx?';
     var param = document.getElementById('tOppID').value;

    if( param != '' ) {
       url += 'Param1=' + param;
       document.forms[0].action = url;
      document.forms[0].submit();
    }
 }
</script>

Open in new window

0
 

Author Comment

by:Matt Pinkston
ID: 40562799
Okay Weird...

Got it all implemented BUT

when I click Submit I get:

Go back to site Error Error
This Page has been modified since you opened it. You must open the page again.

Refresh page.

Troubleshoot issues with Microsoft SharePoint Foundation.

Correlation ID: 87f8fac8-0d09-4c33-9b21-954ae10df24d

Date and Time: 1/21/2015 7:22:44 PM

Go back to site Go back to site

However if I copy the link it produced on top and paste into a new IE I get results?
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 40562816
ok let's change your javascript function to:

function doSubmit() {
     var url = 'http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffing.aspx?';
     var param = document.getElementById('tOppID').value;

    if( param != '' ) {
       url += 'Param1=' + param;
       window.location = url;
    }
 }

Open in new window

0
 

Author Comment

by:Matt Pinkston
ID: 40562980
Now it is doing nothing

<head runat="server">
<meta http-equiv="Content-Language" content="en-us" />
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<style type="text/css">
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
.style2 {
	font-family: Arial, Helvetica, sans-serif;
}
.style3 {
	font-size: 12px;
}
</style>

<script language="javascript" type="text/javascript">
function doSubmit() {
     var url = 'http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffing.aspx?';
     var param = document.getElementById('tOppID').value;

    if( param != '' ) {
       url += 'Param1=' + param;
       window.location = url;
    }
 } </script>  

</head>

<body>

<form id="form1" runat="server">
<span class="style1"><strong>Staffing Profile Search Tool</strong></span><br />
&nbsp;<table style="width: 100%">
	<tr>
		<td style="width: 20%" class="style1">Enter the opportunity ID:</td>
		<td><span class="style2"><span class="style3">
		<input name="tOppID" id="tOppID" type="text" value="OPP-" style="width: 147px" /></span></span>&nbsp;</td>
	</tr>
	<tr>
		<td style="width: 20%" class="style1">&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td style="width: 20%" class="style1">
		<input name="Submit1" type="submit" value="submit" onclick="doSubmit()";/>
		</td>
		<td>&nbsp;</td>
	</tr>
</table>
<br />
</form>

</body>

</html>

Open in new window

0
 

Author Comment

by:Matt Pinkston
ID: 40563161
the code now just refreshes the first screen
0
 

Author Comment

by:Matt Pinkston
ID: 40563226
Since this is not working, is there a way to do the following?

<FORM ID=xxx Action="'http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffing.aspx?Param1=" + Value typed into tOppID
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 40563347
sure, you can just set your form tag as:

<FORM ID=xxx Action="'http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffing.aspx" method="GET">

when the form is submitted, it'll pass along all of the form fields in the query string. whatever name you want to pass make sure the it is the same as your NAME attribute in your input tield
0
 

Author Comment

by:Matt Pinkston
ID: 40563367
don't I need to have the ?Param1= to pass the variable to the receiving ASPX
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 40563382
Nope when you submit a form, it'll pass over all of the data depending on what METHOD you specify. In this case we specified GET, which will pass over the data in the url. Try it and you'll see what I mean
0
 

Author Comment

by:Matt Pinkston
ID: 40563388
Okay I must be screwing this up...

here is the link produced from the code below...

http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/'http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffingx.aspx'?tOppID=OPP-0000613278&Submit=submit

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Page Language="C#" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<meta http-equiv="Content-Language" content="en-us" />
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<style type="text/css">
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
.style2 {
	font-family: Arial, Helvetica, sans-serif;
}
.style3 {
	font-size: 12px;
}
</style>


</head>

<body>

<form id="form1" Action="'http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffingx.aspx'" method="GET">
<span class="style1"><strong>Staffing Profile Search Tool<br />
<br />
</strong></span><br />
&nbsp;<table style="width: 100%">
	<tr>
		<td style="width: 20%" class="style1">Enter the opportunity ID:</td>
		<td><span class="style2"><span class="style3">
		<input name="tOppID" id="tOppID" type="text" value="OPP-" style="width: 147px" /></span></span>&nbsp;</td>
	</tr>
	<tr>
		<td style="width: 20%" class="style1">&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td style="width: 20%" class="style1">
		<input name="Submit" type="submit" value="submit" />
		</td>
		<td>&nbsp;</td>
	</tr>
</table>
<br />
</form>

</body>

</html>

Open in new window

0
 
LVL 34

Expert Comment

by:Big Monty
ID: 40563395
What should it be
0
 

Author Comment

by:Matt Pinkston
ID: 40563403
http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffingx.aspx?tOppID=OPP-0000613278
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 40563418
Take out the single quotes in the action attribute of the form tag
0
 

Author Comment

by:Matt Pinkston
ID: 40563421
http://prime31.sharepoint.xxx.com/teams/hpe%20global%20triage/Lists/PPM%20Assignments/Staffingx.aspx?tOppID=OPP-0000613278&Submit=submit

How do I get rid of the Submit=submit

that is messing it up
0
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 40563432
Try removing the name attribute from the submit button
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 40564298
by the way, how is it messing it up? it should just be ignored on the other end. you could also rename the submit button if the problem is the name "submit", that would be the better choice
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

610 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