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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split Join to serialize multi delimited strings

Status
Not open for further replies.

dokken

Programmer
Mar 7, 2001
61
US
I have a string that is delimited. There are also strings delimited within this string. I want to use split/join to serialize and de-serialize this string so I can pass it in a hidden HTML input tag. Is there an easy way to use split/join to do this or does anybody have a better way to pass this data from page to page.

Right now I am using:

strField = join(request.form("hiddenfield"),"~")

<input typ=hidden value='<%=join(strField,&quot;~&quot;)%>'>

Paul
 
I'm not so sure why you need to join your form values and split them again from page to page. It's not difficult technically. You can do it by either JavaScript or VBScript.

What I'd like to know is why you don't simply pass on the data from page to page using querystring with seperate form names or using cookies or session variables.
They're all available options for you.

Regards
 
Good thoughts here. Working off TechA's response, since you're already used to using hidden fields, why not have one hidden field for each key/value pair. Seems simple and you can have as many of them as you want. You're restricted to the amount of QueryString characters you can have. I have to agree with TechA, unless there's a specific reason for passing a delimited string, use one of the other options.

A few other ideas, if you insist on sending information in one variable, would be to use arrays or the Dictionary Object to store multiple key/value pairs. Of course, if you want those to persist from page to page, they will have to be a session object as well.

Let us know if we're way off base here ..

TW
 
U may use the split/join functions but u must use in the submit form a post method.

Code:
<form name=frmVal id=frmVal action=&quot;...&quot; method=&quot;post&quot;>
<input type=hidden name=val id=val value=&quot;&quot;>
<input type=submit onclick=&quot;return checkVal();&quot; value=&quot;Submit&quot;>
</form>
<script language=javascript>
function checkVal();
{
 //combine your strings
 frmVal.val.value=yourCombinedString;
 return true;
};
</script>

Hope this gives u an ideea... ________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top