html5 - Alternative method of keeping Html placeholder -
i have registration form in razor syntax shown below
<div id="registerdiv" class="is-hidden"> @using (html.beginform("register", "user", formmethod.post, new { id = "frmregister" })) { <label>email</label> @html.textboxfor(lm => lm.email, new { id = "email", name = "email", value = "", placeholder = "enter email" }) <small id="emailerror" class="error is-hidden">a valid email address required</small> <label>password</label> @html.passwordfor(lm => lm.password, new { id = "password", name = "password", value = "", maxlength = "20" }) <small id="passworderror" class="error is-hidden"></small> @html.passwordfor(lm => lm.verifypassword, new { id = "verifypassword", name = "verifypassword", value = "", maxlength = "20" }) <small id="verifypassworderror" class="error is-hidden"></small> <small class="help-block">* must 6-20 characters (letters, numbers , hyphens accepted not spaces)</small> <hr> <div class="form-row"> <div class="six columns"> @html.textboxfor(lm => lm.firstname, new { id = "firstname", name = "firstname", value = "", placeholder = "first name" }) <small id="firstnameerror" class="error is-hidden">first name required</small> </div> <div class="six columns"> @html.textboxfor(lm => lm.lastname, new { id = "lastname", name = "lastname", value = "", placeholder = "last name" }) <small id="lastnameerror" class="error is-hidden">last name required</small> </div> </div> <div class="form-row"> <div class="six columns"> @html.dropdownlistfor(dr => dr.countryid, new selectlist(model.countrylist, "countryid", "name"), "country of residence", new { id = "countryid", name = "countryid" }) <small id="countryiderror" class="error is-hidden">country required</small> </div> </div> <div class="form-action"> <a id="submit" class="form-submit" href="javascript:void(0);">register</a> <a id="cancel" class="form-cancel" href="javascript:void(0);">cancel</a> </div> } </div>
and submit code is
$("#frmregister").submit();
but when application run on ie-8 values of elements id="password" , id="verifypassword" not being sent server. on removing placeholder attribute works fine,that data beng sent server. there fix issue out removing placeholder attribute ? if not there alternative way of keeping placeholder other placeholder = "verify password"
?
the placeholder
attribute new attribute in html5, meaning pre-html5 browsers not work them. give modernizr try, it's meant make html5-only elements/attributes work on older browsers. of course make own javascript function placeholders, it's not difficult. jsfiddle example
Comments
Post a Comment