• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to disable the right click button in Textfield o HTML form with NN4

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have problem like this. I am not able to disable mouse right click in a input text area i was successfull making right click disable on browser window but the same is not working within text field. I want to avoid the user changing the content of text field.


For this i am using
<input type="text" name="field1" value="Hello" onfocus="this.blur()">

This will work for left click but I want avoid the user changing the field value using edit menu (cut,copy,paste) by right click in the text field.

Thanx in advance..

Regards
Saravanan
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why can't you just disable the text field?
 
saravanan kanda swamy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
First I will clear U regd NN4.Here we cannot use the Readonly and Disabled attributes with the textfield .So we were using with the following snippet.

<input type="text" name="field1" value="Hello" onfocus="this.blur()">

Here onfocus=this.blur() will avoid user enetering .I mean when user get the focus on the text field it immediately changes the focus from that field.
So I want the user not to make the field change by right clicking and do cut,copy ,paste option ...

Thanx in Advance..

Regards
Saravanan
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
disable JavaScript and they can change the value!
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or use a scriplet
Either to remove event handler or to set a value.

If you doing code change to have element disabled - why don't you do one more step, and if it should be disabled use div or span or anything else instead of textarea to display it?
 
saravanan kanda swamy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I know that can be done. But the issue Disabling the right click button in Textfield cant be done in the NN4.7x is a technical limitation. I need a valid proof say some link from Netscape saying that it is a bug in that version 4.7x.

I also searched in the web i was not able to get a solution or link..

Can anybody Help!

Thanks in Advance
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simple Solution: Do not use a text field at all, show the content input inside a span that looks like a textbox and place the information into a hidden element.

Eric
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic