[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

FORMS HELP!

Users click a button and search for an employee. When they select their employee from the pop up window, the form submits and adds the employee record. This part works beautifully. What I need to do however, is submit a series of textbox and drop-down list values with it via a querystring. I have a session variable capturing the action and my ID. This sessino variable is where I would like to pass the other form values (for example txtTitle, txtDesc, cboGetAreaID, cboGetCatID, cboGetTypeID).

<%Session("RedirectSearchURL")="hz_main.asp?FromSB=Yes&varAction=AddEmpRB&varTitle="&varTitle&"&varHZID="& varHZID%>
<a href="javascript:openempsearchredirect('Reported By')"><img src="../imgs/main/btn_flashlight.gif" width="24" height="24" align="absmiddle" border="0"></a>
&nbsp;Click flashlight for employees...

Any help would be greatly appreciated.

Thanks,

Tammi
0
okcuser
Asked:
okcuser
  • 3
  • 2
1 Solution
 
ThinkPaperCommented:
I'm still unclear on what your question is. Could you explain it more? I'm also wondering why you're using a session variable to pass values.. you can't use a hidden variable to contain all the info? Submiting forms and showing the values in the URL is something you might not want to do...
0
 
okcuserAuthor Commented:
My page refreshes back to itself. I need to pass the form values so that I have them when the page refreshes.

I have a form with two textboxes and three drop down lists. They are in a form called frmUpdateHZ with an action of UpdateHZ. The "add employee" is using javascript and an include file to automatically submit the employeeID to the database. The problem is that when the user begins to input their data into the form and then they go to select an employee, the form submits without the data they typed into it. So, I need to be able to pass these values along with the main ID using the session variable (as shown above).

I tried using something similar to: document.frmUpdateHZ.txtTitle.Text and place it in a variable that I could then use in the querystring, but that didn't work. The program throws an "object required"

Your thoughts?

Thanks,

Tammi
0
 
ThinkPaperCommented:
1. Beware of how you use session variables. Session variables are used when the value is need on multiple pages (ie. login information) and it should be used sparingly.

2. Ok if I read it right, you have a maing page with some form stuff the user has to enter. One of the form fields is a button to search employees. User clicks the button, a pop up window appears and user finds the employee and clicks ok. The pop up window closes and main window is refreshed, but the other data typed is still there.

Is that right?

I found some links that may help you.
http://www.plus2net.com/javascript_tutorial/window-child3.php

This is basically the code you want in the pop up.

<script langauge="javascript">
function post_value(){
opener.document.f1.p_name.value = document.frm.c_name.value;  <--------------
self.close();
}
</script>

<title>(Type a title for your page here)</title>
</head>


<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">

<form name="frm" method=post action=''>
<table border=0 cellpadding=0 cellspacing=0 width=250>


<tr><td align="center"> Your name<input type="text" name="c_name" size=12 value=test> <input type=button value='Submit' onclick="post_value();">
</td></tr>
</table></form>
0
 
okcuserAuthor Commented:
The JavaScript function might work, but I keep getting a "Type Mismatch" error when calling it through the VBScript.

As a test, I tried the following:

<script type="text/javascript">
     function getTextValue(){
          var strValue
          strValue = "A String Value"
          return strValue
     }
</script>

But I keep getting the "Type Mismatch" error:

     Microsoft VBScript runtime error '800a000d'

     Type mismatch: 'getTextValue'

     /TonerSafety/searchpeople.asp, line 57

Where line 57 is:

<%
     getTextValue()
%>

I need to be able to successfully call the JavaScript function in VBScript, or to duplicate the JavaScript function in VBScript. Any ideas?

Is there an "opener" equivalent in VBScript?

Thanks,

Tammi
0
 
ThinkPaperCommented:
Well.. you're calling a javascript function inside ASP code. You can't do that. You need to define when the ASP ends and Javascript begins and etc..
<%
     getTextValue()
%>

It needs to be like:

'close ASP
%>

<script language="javascript">
getTextValue()
</script>

<%
'open ASP

try using alert(strValue); in your javacode instead of returning to see if it actually returns a value.
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.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now