Hi, I have a client side button to clear my form but there's one particular textfield which does a postback for some operation as seen below (funtion Check) and somehow my this.form.reset() fails to clear that particular field. Please kindly advice. Thanks.
Sorry but that doesn't work. I realised that after the postback trigger by '__doPostBack('ctl00$cphBody$uitxtMemTypeCode', 'OnBlur');', I am not able to clear the field without using code behind way.
k80sg
Member
310 Points
340 Posts
JS this.form.reset fails to clear up one particular field which does a OnBlur postback
Feb 21, 2012 01:57 AM|LINK
Hi, I have a client side button to clear my form but there's one particular textfield which does a postback for some operation as seen below (funtion Check) and somehow my this.form.reset() fails to clear that particular field. Please kindly advice. Thanks.
<input type="button" id="uibtnMemTypeReset" onclick=" removeAllFromList();this.form.reset() " />
function Check()
{
__doPostBack('ctl00$cphBody$uitxtMemTypeCode', 'OnBlur');
}
Shellymn
Contributor
2612 Points
485 Posts
Re: JS this.form.reset fails to clear up one particular field which does a OnBlur postback
Feb 21, 2012 02:33 AM|LINK
You need to explicity clear the value of that particular text box ('ctl00$cphBody$uitxtMemTypeCode').
eg : document.getElementById('ctl00$cphBody$uitxtMemTypeCode').value ="";
k80sg
Member
310 Points
340 Posts
Re: JS this.form.reset fails to clear up one particular field which does a OnBlur postback
Feb 21, 2012 03:36 AM|LINK
Sorry but that doesn't work. I realised that after the postback trigger by '__doPostBack('ctl00$cphBody$uitxtMemTypeCode', 'OnBlur');', I am not able to clear the field without using code behind way.
Song-Tian - ...
All-Star
43705 Points
4304 Posts
Microsoft
Re: JS this.form.reset fails to clear up one particular field which does a OnBlur postback
Feb 22, 2012 08:41 AM|LINK
Hi,
Why you not use "Reset" directly?
Have a try.
Feedback to us
Develop and promote your apps in Windows Store
A1ien51
All-Star
29935 Points
5821 Posts
Re: JS this.form.reset fails to clear up one particular field which does a OnBlur postback
Feb 22, 2012 11:55 AM|LINK
What is the field? Input type??
Eric