Hi,
I am not sure if what I am trying to do can be done, but basically I want to add/edit/delete information in a text area from inputs.
I know how to add from inputs to text area but I am struggling with the edit and delete.
<script language="javascript" type="text/javascript">
function addtext() {
var newtext = document.AddProduct.extran.value + ":" + document.AddProduct.extrav.value + "|";
var newfields = document.AddProduct.extran.value + ":" + document.AddProduct.extrav.value + "|";
document.AddProduct.extraf.value += newtext;
document.getElementById("fields") += newfields
}
function removetext()
{
var re = new regExp("(^|,)\\s?user3","gi");
document.getElementById('extraf').innerHTML = document.getElementById('extraf').innerHTML.replace(re,"");
}
</script>
</head>
<body>
<form method="post" enctype="multipart/form-data" action="process-forms.php" name="AddProduct" class="admin_form">
<dl>
<dt><label for="Addfield">Custom Field(s) :</label></dt>
<dd>Name: <input size="10px" type="text" name="extran" id="extran" value=""> Value:<input size="10px" type="text" name="extrav" id="extrav" value=""></dd>
</dl>
<dl>
<dt>blej</dt>
<dd><textarea name="extraf"></textarea>
<input type="button" value="Add New Text" onClick="addtext(AddProduct);"><br/>
<input type="button" value="Remove Text" onClick="removetext();">
</dd>
</dl>
<div name="fields" id="fields">here</div>
</form>
Currently if you click add, it adds the 2 input fields in to the text area separated by : and then ended by | so I can determine new lines, the first input will be "name" the second will be the "value".
What I would like to do is be able to edit and delete these from the text area if possible?
Hope some one can point me in the right direction?
Thanks