I’m using JsGrid and I can’t find if when I click on a button (inside my JsGrid-each row contains a button) it’s possible: to get a specific value from that row and load it to another page. Something like data editing in another page (maybe just get the ID (for example) and then, in this other page, I do the SELECT again).
If it’s possible (click on a button, get specific value and send it to another page), please let me know which callback to use (and how or an example, just to know how to properly use it).
Related
I'm very new to scripting stuff, but here's what I'm trying to do. When visiting a webpage, there are two dropdowns available, but the second is disabled until a selection is made in the first. The content of the second populates automatically as soon as something is selected in the first, and each option in the first leads to a unique set of options in the second. I'm attempting to automate selecting items in both. I can set a value in the first using "document.getElementById('firstDropdown').value = 'myValue'", and I can get the label of myValue to appear in the dropdown window, but I can't get the second dropdown to populate because it doesn't realize that I've made a selection since I'm not physically clicking on something. Is there a way to reload or refresh only secondDropdown (not the entire page) so that it realizes I have made a selection for firstDropdown and thus populate?
You can trigger change event of firstDropdown with below code using the Event Constructor.
document.getElementById('firstDropdown').dispatchEvent(new Event('change'));
I have a list of products on page A and want to add them to a shopping cart on an external page B (by clicking a button on page A). I already have the correct Ids from page B and their single product page url. I'm looking for the correct (and secure) approach on this one.
My current approach would be using a browser extension which passively listens to the specific button click on page A and then takes action (e.g. by automatically opening a new tab and submit every product page individually). Extending this idea a bit further I could check the form submit url of page B and make use of it automatically.
However using an extension limits this feature to desktop only.
I already thought about using a bookmarklet but using that approach a user always has to actively activate the bookmarklet (from what I know) instead of it listening passively ...
Am I on the right track here or is there another different way I could go?
You can try to add your item id to a variable array each time you select one and then pass the array variable to the page B either by using arguments or using a POST method.
When purchasing a course, the user can enter 1 or more students to register for the course. By default there is only one entry but the user can use a dropdown to select more and then the form will update to show more.
I am accomplishing this by triggering an event when the user changes the dropdown value that uses ajax to call an action which returns a partial with the appropriate number of entries and then I just replace the existing div with the new one.
My question is whether there is a way to implement this so that it's kind of like "refreshing" the page where the form remembers and automatically refills in he values the user already entered just like if you were to refresh the entire webpage. Is there a way to do this, or will I need to pass in the existing values into the action in my ajax call and have the partial set them?
A secondary question I just thought of (and perhaps this should be in another post but I will go ahead and put it here for now) is whether I should be concerned about any weird behavior with validation when doing it this way? (I'm using stock, built in validation with annotations).
I have a table of tasks that users can assign themselves to. There is an Assign button and when they click it, I would normally want to create a POST request, assign the task to the user, and redirect them to the task details page. Normally that's fine and I could do that with a button in a form, but they also want to be able to click that button and have the task details page open in a new tab.
So if they were on the main page and wanted to grab three of the tasks, they would want to be able to Ctrl + Click or middle click the button, have each of those pages load in a new tab, and be assigned to each one they clicked.
That leads me to believe I need to make it a link instead of a button? But then that means the request would be a GET request. Would anyone be able to give me a good idea on how I could accomplish this?
I'm using AngularJS 1.4, but even without Angular, I'd be curious to know how I should handle this.
Thanks in advance.
You miss something really nice, in pure HTML. Forms (the common way of doing POST request, isn't it) can have a target attribute, as links do, so the result can be displayed on another tab/window. Here is a sample :
<form action="demo_form.asp" method="get" target="_blank">
...
</form>
Here are the possible target values : _blank|_self|_parent|_top|framename
If you need your result page to be displayed in one place or one another, (multiple buttons i.e.) then this will be the good moment to use javascript, for editing this target property.
I'm pretty sure I can't do what I'm actually asking, but am wondering if there is some sort of workaround for the issue.
I have a page that has a drop down SELECT form element with several options. If one particular option (in this case, the first item) is selected, we show additional content (via jQuery). This works fine.
What happens, though, is that if I select item 2, the additional content disappears, as it should. I then go to a different page and then hit BACK. A that point, the page properly has kept that additional content hidden (as it was the last state) but the SELECT menu has been reset to the first item. I then have to click the SELECT, pick a different option, then select it again picking the first option, which finally brings the additional content back.
I can't trigger Javascript from what I can tell on a cached page (or is there a way?) Any other clever options?
One option I've come up with is to apply some sort of mouseover action to the area that houses the SELECT menu that does a quick 'reset elements' check. This seems a bit hacky and, of course, will produce an odd screen redraw unexpectedly for people.
You can record that the user action has taken place and re-execute it using JavaScript. You can store it in a cookie, then check for it on page load and reset the elements you want.