Website does not recognise form input modified with javascript

I am writing a chrome extension that extends a piece of software that I need to use for my work. I want to be able to copy all the form data from one page to another, but when I click save it immediately reverts to what it was before.

$(document).keypress(function(e){
  //alert(e.which);
  if (e.shiftKey && ( e.which === 67 )) {
    var inputs = $("input[type|='text'], select");
    for(var i=0; i < inputs.length; i++)
    {
      var id = $(inputs[i]).attr("id");
      var val = $(inputs[i]).val();

      if(id != undefined && id.indexOf("rmaAssetComponents") != -1)
      {
        id = id.split("_")[7];
      }

      writeCookie(id, val, 1);
    }
  }
  if (e.shiftKey && ( e.which === 86 )) {
    var inputs = $("input[type|='text'], select");
    for(var i=0; i < inputs.length; i++)
    {
      var val = $(inputs[i]).val();
      var id = $(inputs[i]).attr("id");
      var searchId = id;

      if(id != undefined && id.indexOf("rmaAssetComponents") != -1)
      {
        searchId = id.split("_")[7];
        //console.log(searchId);
      }

      if(val == '')
      {
        $("[id*='"+id+"']").val(readCookie(searchId));
      }
    }
  }
});

I know the code is spaghetti, please don't judge me too much. The gist is that I am storing the values of text inputs in cookies and then copying them using the .val() jquery function. Any help is appreciated.

Edit
So it seems that the only inputs that it messes up on are editable dropdown menues. Not sure why still.

Chrome Storage – Username/Password

I’m having some problems with my chrome extension… I’m trying to save a username and password for auto-filling on another page – problem is it wont let me edit the username, although it fully works on password…

For clarification, brugernavn = username – adgangskode = password.

Popup window

The javascript activated through html popup is following:

Username:

  window.addEventListener('load', function load(event) {
      chrome.storage.local.get(['brugernavn'], function(result) {
          if (result !== undefined && result.brugernavn !== undefined) {
              document.getElementById('brugernavn').value = result.brugernavn;
    }
});

  document.getElementById('gem').onclick = function() {
    chrome.storage.local.remove('brugernavn');
      chrome.storage.local.set({'brugernavn': document.getElementById('brugernavn').value});
    };
});

Password:

  window.addEventListener('load', function load(event) {
      chrome.storage.local.get(['adgangskode'], function(result) {
          if (result !== undefined && result.adgangskode !== undefined) {
              document.getElementById('adgangskode').value = result.adgangskode;
          }
      });

  document.getElementById('gem').onclick = function() {
    chrome.storage.local.remove('adgangskode');
      chrome.storage.local.set({'adgangskode': document.getElementById('adgangskode').value});
};
  });

So password works fully, but I’m not able to edit username to save a new username.

Thanks in advance.

how to check what values are submitted by a form through devtool? [duplicate]

This question already has an answer here:

I want to test what values has been sent with the form after submitting a form.
Is there a way to check it from the chrome devtool or any other tool?

POST to new tab from Popup Script – Chrome Extension

I am trying to open a new tab on chrome and make a POST request to it, as soon as it opens. I have found this answer, which, as far as I understand, ‘is creating a form element with a content script and posting the form’. However, I am not sure if this is the best way to go for doing it from a popup script.

(Simplifying everything down), I have my popup.html like this:



And popup.js,

$('button').click(function() {
    // open a new tab and do a POST request
});

At this point, should I create a background script and do what Xan did here? Or did I have some misunderstanding what background can/cannot do? I am pretty confused on how to implement the “open a new tab and do form POST request” approach on a popup script.

Chrome extension – remove default text from forms using jQuery

I’m developing a Chrome extension, and I want to be able to insert saved data back into forms. In certain forms, some of the input elements will have default text. The problem I’m having is when I try to insert data into the form, the text retains the same class as if it was default text, and I want the text to appear as if a user entered it themselves. I tried triggering the ‘focus’ event for input elements with the following code:

$('form').find("input[type='text']").focus()

The code doesn’t work for my extension, but does work when I type it in the console. Any suggestions on how to get it to run?

Automate Filling Form Between Tabs In Chrome Extension

I want to take information that I receive in my gmail inbox and automatically copy it, open a new tab with my company’s other forms, and auto fill that form with the email info then automatically submit the form. I have to do hundreds of these a day, so I want to automate the whole process ideally. I can successfully capture all the values using jQuery, but I’m wondering how to open a lot of new tabs in chrome and auto fill all of the forms. Any thoughts are appreciated!