javascript - how to retrieve html5 form values -


am working on html5 form.

am having problems when comes on retrieving values drop down lists,time , values have spaces.

for drop down lists | converted %7c, time : converted %3a , or pm not shown while spaces converted +. there way retrieve form values way appear users.

if forced convert them there original values using regular expression,which ones work above problems

am new jquery spare me if there ambiguity in question in advance.

below sample code of project.

 **switch (questiontype) {         case "vtfh44uf34f4fh3": //textbox              $('#variables').append($('<input id="' + variableid + '" name="' + variableid + '" required type="text" data-mini="true"  placeholder=""/>'));             $('#variables').trigger('create');             break; }** 

above code how creating controls dynamically.

 **function showvalues() {            var str = $("form").serialize();      str  = str .split("&");     (var = 0; < str .length; i++) {         var str2  = str [i].split("=");         var name = str2  [0];         var value = str2   [1];     }       }   showvalues(); 

}**

above code how getting form values

here output of:

encodeuri('aaa bbb ccc 10.10.12|') => "aaa%20bbb%20ccc%2010.10.12%7c" 

in order original value execute:

decodeuri('aaa%20bbb%20ccc%2010.10.12%7c') =>  "aaa bbb ccc 10.10.12|" 

use methods:

encodeuri() decodeuri() 

Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -