How to disable copy paste,spellcheck,autocomplete in Cordova Android application? At time text typed by user gets autocompleted.
- 
                    there are some css rules you can add to disable copying text -- http://stackoverflow.com/questions/826782/css-rule-to-disable-text-selection-highlighting – Tasos Sep 21 '15 at 06:42
- 
                    @MuhammadUsman - I have tried restricting it by using jQuery 'paste' and trimming extra characters but a lot of manipulation is required as I have to validate lot of characters. It's a banking app. Passing any invalid data means dirty payload hence server rejects it completely – nickalchemist Sep 21 '15 at 07:02
5 Answers
 $('input').bind("contextmenu", function (e) {
        e.preventDefault();
    });
Please try this code if not use contextmenu functionality in your app otherwise contextmenu functionality will be stop working
 
    
    - 198
- 10
 **Use below code:**
 <style type="text/css">
 *:not(input):not(textarea) {
 -webkit-user-select: none; /* disable selection/Copy of UIWebView */
   -webkit-touch-callout: none; /* disable the IOS popup when           long-press on a link */
  }       
  </style>
 **If you want Disable only anchor button tag use this.**
      a {-webkit-user-select: none; /* disable selection/Copy of      UIWebView */
    -webkit-touch-callout: none; /* disable the IOS popup when   long-press on a link */
 }
 
    
    - 487
- 5
- 15
What @Tasos says in his comment is valid, if you want all user selection disabled in the app you can use the answer from this question: Disabling text selection in PhoneGap
I looked all over for help on this. This finally worked for me.
public class MainActivity extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.loadUrl("file:///android_asset/www/index.html"); super.appView.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View v) { return true; } }); } }The setOnClickListener is what does the magic. Make sure you put this AFTER your call to super.loadUrl.
 
    
    - 1
- 1
 
    
    - 10,564
- 3
- 29
- 62
I don't have idea about Javascript and Cordova but in Android code you can try this.
Required API level 11 or above.
edittext.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            return false;
        }
        public void onDestroyActionMode(ActionMode mode) {                  
        }
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            return false;
        }
        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            return false;
        }
    });
Returning false from onCreateActionMode(ActionMode, Menu) will prevent the action mode from being started(Select All, Cut, Copy and Paste actions).
 
    
    - 6,951
- 6
- 35
- 38
So, i don't know, if your suggested answers are working. He wanted to know, how he can deactivate this inside a Cordova application. For what did you post native code than?
Normal input field without deactivation would look like this:
<input id="username" type="text" placeholder="Username">
To deactivate those things, just edit it, that it looks like this:
<input id="username" type="text" placeholder="Username" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
Hope that helped!
 
    
    - 3,655
- 8
- 32
- 67
