Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Add a reset button to clear textbox input

Add a reset button to clear textbox input 2 years 8 months ago #101695

  • boyan
  • boyan's Avatar
  • Offline
  • Senior Lime
  • Posts: 49
  • Thank you received: 9
  • Karma: 1
Dear all,

I am trying to add a reset button so that a respondent can clear textbox input and retype without leaving the survey. Here is my code but it doesn't work. Any guidance is appreciated. Thanks!

<input id="reset" onclick="reset()" type="button" value="Reset" />
<script type="text/javascript">
function reset() {
document.getElementById("answer548129X3X1241").value=" ";
document.getElementById("answer548129X3X1242").value=" ";
document.getElementById("answer548129X3X129").value=" ";
}
</script>
The administrator has disabled public write access.

Add a reset button to clear textbox input 2 years 8 months ago #101712

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1794
  • Thank you received: 439
  • Karma: 110
Hi,

A big part of your required code is probably here.
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
The administrator has disabled public write access.
The following user(s) said Thank You: boyan

Add a reset button to clear textbox input 2 years 8 months ago #101714

  • boyan
  • boyan's Avatar
  • Offline
  • Senior Lime
  • Posts: 49
  • Thank you received: 9
  • Karma: 1
problem solved. I think I could not use reset which might be a reserved word. After changing reset to formreset, it worked perfectly.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.249 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form