javascript - How to set value in textbox value after form submit? -
how set value in textbox value after form submit?
im using js block still im having troubles storing value in textbox or div
<script type="text/javascript"> (function($,w,d) { var jquery4u = {}; jquery4u.util = { setupformvalidation: function() { //form validation rules $("#register-form").validate({ rules: { wsndate: "required", wsndescription: "required", wsncrs: "required"}, messages: { wsndate: "please enter wsndate", wsndescription: "please enter description", wsncrs: "please enter crs" }, submithandler: function(form) { //form.submit(); //retrieving form values var wsnstring = ""; _wsndate = document.getelementbyid("wsndate").value; _wsndescription = document.getelementbyid("wsndescription").value; _wsncrs = $('select[name="' + $('select[name="dropdownmain"]').val() + '"]').val() //computation page update (simple) _pageupdate_simple = document.getelementbyid("pageupdate_simple").value; if(document.getelementbyid("pageupdate_simple_urgent").checked) { //page update simple urgent! var _pageupdate_simple_unit_price = 30; } else { //page update simple normal var _pageupdate_simple_unit_price = 15; } _pageupdate_simple_cost = _pageupdate_simple * _pageupdate_simple_unit_price; //computation page update (complex) _pageupdate_complex = document.getelementbyid("pageupdate_complex").value; if(document.getelementbyid("pageupdate_complex_urgent").checked) { //page update complex urgent! var _pageupdate_complex_unit_price = 50; } else { //page update complex normal var _pageupdate_complex_unit_price = 25; } _pageupdate_complex_cost = _pageupdate_complex * _pageupdate_complex_unit_price; //computation pdf update/upload _pdfupdate = document.getelementbyid("pdfupdate").value; var _pdfupdate_unit_price = 15; var _succeeding_pdf = 7.5; var _pdfnumbers; var _subsequent; var _pdfupdatecost; if(_pdfupdate > 1) { _subsequent = _pdfupdate -1; var _subsequentcost; _subsequentcost = _subsequent * _succeeding_pdf; _pdfupdatecost = _pdfupdate_unit_price + _subsequentcost; } else if(_pdfupdate == 0) { _pdfupdatecost = 0; } else { _pdfupdatecost = _pdfupdate_unit_price; } //computation add/update promo box _promoboxupdate = document.getelementbyid("promoboxupdate").value; var _promoboxupdate_unit_price = 15; var _succeeding_promobox = 7.5; var _promoboxnumber; var _subsequentpromobox; var _promoboxupdatecost; if(_promoboxupdate > 1) { _subsequentpromobox = _promoboxupdate -1; var _subsequentpromoboxcost; _subsequentpromoboxcost = _subsequentpromobox * _succeeding_promobox; _promoboxupdatecost = _promoboxupdate_unit_price + _subsequentpromoboxcost; } else if(_promoboxupdate == 0) { _promoboxupdatecost = 0; } else { _promoboxupdatecost = _promoboxupdate_unit_price; } //computation page creation _pagecreation = document.getelementbyid("pagecreation").value; if(document.getelementbyid("pagecreation_urgent").checked) { //page creation urgent! var _pagecreation_unit_price = 100; } else { //page creation normal var _pagecreation_unit_price = 50; } _pagecreation_cost = _pagecreation * _pagecreation_unit_price; //append values costs var _wsncost = _pageupdate_simple_cost + _pageupdate_complex_cost + _pdfupdatecost + _promoboxupdatecost + _pagecreation_cost; wsnstring = _wsndate+'_'+_wsndescription+'_'+_wsncrs+'_$'+_wsncost; //session["wsnvalues"] = wsnstring; //window.location.href = 'page2.html'; alert(wsnstring); //window.location.href = 'page2.html'; } }); } } //when dom has loaded setup form validation rules $(d).ready(function($) { jquery4u.util.setupformvalidation(); }); })(jquery, window, document); </script> i want set value of wsnstring textbox or div can copy generated text. possible?
$('#mytextbox').val(wsnstring).
Comments
Post a Comment