Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a string session variable, get 'x' is Undefined

Status
Not open for further replies.

kerrytkd

Programmer
Mar 30, 2001
2
US
I've gotten a lot of valuable time saving info from this site... thanks! Now a question I couldn't find an answer to:
When passing a session variable that is a number (session("year")), the Crystal Report recognizes it as a parameter, but when passing a session variable that's alphanumeric (session("company")), I get an error message that says 'AI' is Undefined. (AI is the session("company") variable value). Here's my code, any ideas? It's probably something simple, but....

<script language = &quot;JavaScript&quot;>
function ProcessForm4(prompta, promptb, promptc, promptd){
//This line generates a 3 digit random number and assign to 'HitCount' parameter in the report
HitCount = Math.round(Math.random() * 1000);
form4.prompt3.value = HitCount;

littlewin = window.open('CostCenterSummary.rpt?init=html_page&prompt0=' + prompta + '&prompt1=' + promptb + '&prompt2=' + promptc + '&prompt3=' + promptd , 'reportwin','width=950,height=500,top=10,left=10,screenX=10,screenY=10,scrollbars=yes,location=yes, toolbar=yes'
);
}
</script>

<html>
<Form method=&quot;GET&quot; id=&quot;form4&quot; name=&quot;form4&quot;>
<input type=&quot;hidden&quot; name=&quot;prompt0&quot; value=&quot;<%=session(&quot;BudgetYear&quot;)%>&quot; size=&quot;5&quot;>
<input type=&quot;hidden&quot; name=&quot;prompt1&quot; value=&quot;<%=rtrim(session(&quot;Company&quot;))%>&quot; size=&quot;5&quot;>
<input type=&quot;hidden&quot; name=&quot;prompt2&quot; value=&quot;<%=rtrim(session(&quot;UserID&quot;))%>&quot; size=&quot;5&quot;>
<input type=&quot;hidden&quot; name=&quot;prompt3&quot; value=&quot;0&quot; size=&quot;5&quot;>
<input type=&quot;Submit&quot; id=&quot;Submit4&quot; name=&quot;Submit4&quot; value=&quot;Display Report&quot; onClick=&quot;ProcessForm4(<%=session(&quot;BudgetYear&quot;)%>,<%=rtrim(session(&quot;Company&quot;))%>,<%=rtrim(session(&quot;UserID&quot;))%>,Math.round(Math.random() * 1000))&quot;>
</form>
</html>

 
Nevermind, sorry, knew it was somthing simple. Just needed single parens around <%rtrim(session(&quot;Company&quot;))%> in the onClick portion of the code to indicate a string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top