html - JavaScript to output form fields to a textarea ends with textarea being outputted but then immediately clearing itself? -


here's brief rundown of issue:

i have javascript function gets value of bunch of form fields, combines them variable called outputarea, , use same function change value of textarea called "outputarea" value created outputarea in jscript (document.thisform.outputarea.value = outputarea).

but when press "make notes" button calls function, grabs variables, hits alert dump variables make sure working, outputs form field want to... however, after function completes, clears itself. itself, mean whole form clears, including outputarea.

i've checked source numerous times , there 0 references reset button or should clearing these values after function called, i'm @ loss.

below function:

<script type="text/javascript">     function getnotes() {         var spoketo = document.thisform.spokewith.value;         var problemwith = document.thisform.problemwith.value;         var resolvedby = document.thisform.resolvedwith.value;         var thistech = document.thisform.techname.value;         var livechat = document.thisform.onlivechat.value;         var passto = document.thisform.passto.value;         var fspace = ".  ";         var fsign = "  - ";          alert(spoketo + problemwith + resolvedby + thistech);          outputvalue = 'spoke with: ' +spoketo + fspace + problemwith + resolvedby + passto + fsign + thistech;         document.thisform.outputarea.value = outputvalue;         alert('dismiss');     } 

the button calls function simply:

<input type="submit" class="button" value="make notes!" onclick="javascript:getnotes();" tabindex="4" style="margin-right:1em;" /> 

and output field:

<textarea name="outputarea" id="outputarea" onclick="this.select();" readonly="yes"></textarea> 

i added alert('dismiss'); in attempt see if (temporarily) stop form clearing forcing user press ok alert, strangely enough, calls alert before calls document.thisform.outputarea.value = outputvalue, don't understand. after calls , outputs, clears every form field. javascript function on whole page, , there no reset buttons anywhere in sight.

i've done tons before , have application similar method running , working fine right now, i'm baffled. in heck doing wrong here?

i appreciate taking time looking me. cheers!

this looks me page refreshing because button performing submit action. change onclick event this:

onclick="getnotes(); return false;" 

because generating post request (probably itself), page loading if first time.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -