Firefox remembers what you have so far entered in a given text input and as soon as you start typing it suggests previous values matching what you have typed so far.
Is it possible to access this list via javascript?
Thanks.
Firefox remembers what you have so far
entered in a given text input and as
soon as you start typing it suggests
previous values matching what you have
typed so far.
This features is there with the browser itself.
Is it possible to access this list via
javascript?
I am afraid, that's not possible
No that is not possible, that information is private to the user.
If it was possible, you could just put a textbox with the name "email" or "password" on a page, and start harvesting whatever people wrote in such textboxes on other sites.
Even if you limit the access to the same site, people doesn't always want to be associated with what they did earlier. If I for example accidentally made a search for something that happens to be urban slang for something else, I don't want "relevant ads" to follow me.
Related
For work we have a little tool that shows how many hours people have worked, and there is a "filter by name" box that I usually just fill with my name to see my hours.
I have this page bookmarked, but every time I have to fill in the filter. Sadly there is no url-parameter I can add to automatically fill this filter.
So I was wondering, is there a way to have a bookmark in Firefox that open a webpage, and then fills in the filter input for me? I know it's possible to have javascript in the "location" field of a bookmark, but I couldn't find a way to have both a url and javascript.
Note: Luckily the filter input has an id called "searchInput". So it is easy to get it through javascript.
Is something like this possible?
I've spent hours on this one.
My company is forced to use a non-user-friendly 3rd party website. We only use IE11. My job is to use javascript and jquery to customize the screen and make things a little easier for our users. I use a bookmarklet to insert <script> tags into IE and reference a .js file saved locally.
This website uses hundreds of input text fields but we only need a handful of them. So, I want to highlight input text fields on the screen.
Some fields have ID's some only have Name. For the most part, this works:
$(document.getElementById('s_3_1_18_0').toggleClass("highlightField");
$(document.getElementsByName('s_3_1_19_0')[0]).toggleClass("highlightField");
HighlightField simply adds CSS background-color: yellow !important
The problem is, this 3rd party app changes the ID and the Name in bizarre ways. One day, the name will be 's_3_1_19_0', the next it will be 's_3_2_48_0'. So highlighting using this method is not stable.
However, these fields have an area-label that stays constant. I'm wondering how to use javascript or jquery to iterate through each text box, looking for a specific aria-label. For example, the "valid to" field has a bizarre name that changes all the time but it's aria-label is always "Valid To".
Can anyone please help me with this?
You can find the input with the aria-label "Valid To" by searching for
$(document).find('input').attr('aria-label', 'Valid To');
I recommend being a little bit more specific than $(document), though. That searches the entire doc.
You can use jquery to get the list of all aria-label attributes and use a switch case to perform what you need. Something like this
switch ($(this).attr('aria-label')) {
case 'label1': {
//do something
break;
}
}
I have a Java EE JSF/Primeface app with an entry form for adding/editing an entity. Let's call it Product On that form is a field to specify the Salesperson, which would really be the Salesperson's Employee Number. But most data entry users don't know the salespersons employee number off the top of their head.
I'm looking for a way to either click open a popup window where the user can put in a keyword or two, find the right B.Smith, J.Doe, etc..., click their name and have that appropriate employee number pop into the text box on the parent form.
Or somehow do this inline in the parent form where the user starts typing any keyword and ajax queries the employee database, appropriate salesperson is selected and the employee number replaces the keywords typed in the input text box.
A nicety is to have (in an non-editable state) next to the text inputbox with the employee number, the salesperson's full name corresponding to the employee number.
Or some variant of those.
I had this working in a JSP application using some hacked together javascript, but I'm having trouble porting the functionality to JSF/Primefaces and was wondering if this functionality is already available in either technology. I've been searching for a solution for a while.
One of the biggest issues if I continue to use my old javascript is knowing the the parent forms textbox id to know where to pop the value in. Using JSF form I'm getting things like j_idt28:j_idt29
You should not need to mess around with Javascript for that case, so you won't need to know the generated ids.
Since you use PrimeFaces, you may want to look into the Autocomplete component.
Besides that, you can always make use of the f:ajax tag to respond to user input and update fields according to it for example.
I have an HTML form with two input textfields.
When the user tabs from the first field to the second, I'd like to automatically switch the user's input method to a different one, say for a different language.
The reason I'm trying to do this is that I expect the user to type content in known different languages in each field.
I tried <input lang="JA" /> but that didn't seem to change the input method on Safari for Mac nor iOS.
Is it possible in HTML or JavaScript to change the input method on a per-textfield basis?
Input methods are controlled by the browser and the user. The lang attribute does not affect this, and there is no other HTML way either. It would not be useful to change the input method on a per-document, still less per-field basis, from the method normally used in the browser and accepted by the user (either silently or by finding out how to control such things).
In some situations, it can be helpful to provide special tools to users—not to override input methods but to offer additional possibilities. For example, if the expected language is written in Latin letters with a few extra letters in addition to the basic a–z, you could have buttons for entering them (to help people using keyboards that have no convenient way to type them).
It is possible to build controls that act as input method editors, see e.g. typd.in for entering Japanese. But this means using something on top of the input methods that the user is using.
Specifically what I'd like to do is "alter" one of the fields in the Google Calendar field entry for my own purposes. Namely the location is almost always going to be one of four locations, but the way the Google Calendar is set up it doesn't track frequently entered information, and writing the full address every time (or keeping a notefile w/ the 4 addresses to C&P) is kind of annoying.
Ideal I suppose would be an "extension" or script that would automagically detect that I'm filling out a Google Calendar event entry and change the location field to a drop with the four addresses I frequently use as well as an "other" option.
Another possibility might be some kind of bookmarklet (or set of 4) that fills the location field in.
I don't really know where to start or which method would be better (hell, there might well be a third option that is superior).
PS: If this would be easier/more efficiently done in Firefox or some other browser rather than Chrome that is fine as well.
I'd go with bookmarklets. Here's a potential URL for setting addresses given the current Google Calendar page (the id of the "Where" input is ":1u"):
javascript:document.getElementById(':1u').value='123 Some st.'; void(0);
I'd write bookmarks with URLs similar to the above for each of your 4 addresses and then put them into an easily accessible folder, and use them each time you want to populate that address.
UPDATE:
Since the ID changes, you can get it by the class name. However, if the class changes or the number of inputs before the Where field changes, you'll have to update your links:
javascript:document.getElementsByClassName('textinput')[1].value='123 Some st.'; void(0);
UPDATE 2:
Apparently Google doesn't consider the current value of the textbox when a Calendar item is saved. I fixed this by manually firing the 'change' event after the value of the textbox is updated. The following currently works in Firefox:
javascript:var a=document.getElementsByClassName('textinput')[1];a.value='123 Some st.';var e=document.createEvent("HTMLEvents");e.initEvent('change',true,true);a.dispatchEvent(e);void(0);