Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clear/Reset - READONLY fields....

 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, based on this discussion I changed my DISABLED fields to READONLY fields. Now, on (second thought) a bit more testing, I realized I need that ugly (as you call it) scripting option as well. My form also has a reset type 'Clear' form button. The 'READONLY' form fields, are not cleared.

Well, I added an onClick function and attempted to reset the form fields. But I get a JS error saying 'form.MyTextBox has no properties'.

Any clues please.
Thanks.

- m


Edited:

This is the script I have -



I also know that the JS is getting called. I checked this with alert(...) and it did alert me.
[ July 07, 2005: Message edited by: Madhav Lakkapragada ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
clearResetReadOnlyForm2(this.form)
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also hint

instead of spacing out onclick="wow" use

&111; in place of the o

Eric
[ July 07, 2005: Message edited by: Eric Pascarello ]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope that didn't help. I don't get any errors now, but the values are not cleared. Something weird going on.

- m
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the value is being reset by the button to what it started out as. SO lets break out the big and the ugly.



For easy copy/paste look here: http://radio.javaranch.com/pascarello/2005/05/25/1117043999998.html

Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to take my hour drive home so you are on your own.

Eric
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahh....I am missing the return false;. With that peice added, it is erasing the values alright, but my form seems to be pretty useless since the some of fields are still READONLY.

I think I need to have a BACK button instead of this whole reset form fields function. I hate to POST it to the server and do a RequestDispatch(...) back to the original JSP. Is there a decent way of doing this on the client side? Well other than the browser back button.

- m
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
history.back()

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic