How to get the form value if the value have the & symbol inside

dormingo's Avatar, Join Date: Mar 2006
Newbie Member
Hello buddy, I have a problem of passing the Value in HTML Form to the VB Script function.

Like example: My Text1 value="1234&abc"

when pass the Text1 value to the Function(Text1.value), The Value pass in it will be 1234.
but the actual is 1234&abc. ( Client Side )

How Should I solve this Problem.....? Thank you...

The Source Code:
<html>
<form name="form1">
<input type="text" name="refno" value="1234&abcde"><input type="button" value="Submit"onclick="CheckSubmit(document.form1. refno.value)">
</form>
</html>
<script language="vbscript">
function CheckSubmit(refno)

document.write(refno) ' The result will be 1234 Only, not 1234&abcde

end function

Last edited by dormingo; 4Mar2006 at 06:19..
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Can you provide the complete code where this thing is happening.
coderzone's Avatar, Join Date: Jul 2004
Team Leader
The problem is not with the passing of the variable but its the problem with the printing of value in the document.

Try doing this and all should be fine
Code:
document.write("<PRE>")
document.write(refno) ' The result will be 1234&abcde and not 1234
document.write("</PRE>")
Happy coding.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
I never knew you have edited the post to include the Code. Making a new post sends an email to all the posters of the thread and so it helps evryone to reply. If you just edit the new post try posting a line like I have edited the tread to include the code so that everyone knows.

Also yes you have the solution now probably.