loop trough list of elements and update hidden field seperated by vertical line and comma

loop trough list of elements and update hidden field seperated by vertical line and comma

I can have a unlimited set of list items and form fields (limited) in li:

<li id="apr1">
<textarea class="thisistext">blablabla</textarea>
<input class="imgid" type="hidden" value="450">
<input class="order" type="hidden" value="1">
</li>
<li id="apr2">
<textarea class="thisistext">bimbimbim</textarea>
<input class="imgid" type="hidden" value="455">
<input class="order" type="hidden" value="2">
</li>

etc

What I want is, write the contents of of all field in hidden field for update to database:
The format should be values from field seperated by comma and groups seperated by vertical line | 

"imgid,order,thisistext|imgid,order,thisistext|etc...  "
<input id="thedatafield" value="450,1,blablabla|455,2,bimbimbim| etc...">

How would you accomplish this?  Probalby, the .serialize() would help, but the important part is textarea, which can be in pure html format.