GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Clear/Reset -  READONLY fields.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Clear/Reset -  READONLY fields...." Watch "Clear/Reset -  READONLY fields...." New topic
Author

Clear/Reset - READONLY fields....

Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
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 ]

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
clearResetReadOnlyForm2(this.form)
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Jun 03, 2000
Posts: 5040
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
I am going to take my hour drive home so you are on your own.

Eric
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
history.back()

Eric
 
GeeCON Prague 2014
 
subject: Clear/Reset - READONLY fields....