Hello!
I have a question regarding making a smart delete/reset function so I dont have to make one for every element in my form.
Different types of input, selectbox and check boxes will be shown depending on what the user have clicked on. For example if a user selects row 2 in my <select> a <div layer> with a couple of checkboxes will be shown (div style=” visibility” is set to visible);
But if this should work all elements that arent “visible” must be reset to their “default value” so the request will be correctly made.
So my question is lets say I have a function called delete() can I send an object that should be reset and in my delete() function detect which kind of form-element the retrieved object is of ,se below what I want to do:
<script…..>
function delete(myobj){
if(myobj.isTextfield){
document.getElementById(myobj.id).text=””;
document.getElementById(myobj.id).value=””
}
if(myobj.isSelectbox){
document.getElementById(myobj.id).selectedIndex[0]=true;
}
}
</script>
<form name=”myform”…>
<select name=”myselect”>
.
.
</select>
<input name=”mytext” type=”text”…>
</input>
</form>
I hope U understand what I want to achieve…maybe there is a simplier way to achieve this or?
Regards/D_S