I have written a control panel for managing devices, however as we have imported hundreds of them, there are a lot of values that need to be manually set. I have an overview page that shows the most import information and I am looking at some way to allow the end-user to change those values by clicking them.
Right now they are just text in TD cells pulled from the Database. Would it be possible to do something like double clicking the cell changes it to a drop-down box of options and then when deselected it automatically saves it to the database?
I have been searching Google and Stack Overflow but I am not even sure what to search for to get an idea of how to accomplish this.
To do this you must (short version):
Handle click event on your value from table
Change(hide text and display input) text for input with setted value
Handle blur event on your input
If some changes have been made, send Request (by AJAX) to your php actions which save value in database. Or do nothing if there were no changes.
Change(hide input and display text ) input to text
Related
I have a website which has 3 select boxes at the top. These select boxes are used as filters for a table I am displaying underneath it. When you change something on the select box I filter the table.
If I change the select box values and go to a new page and hit the back arrow at the top and return to the same page all of my select boxes changes are still there. However, the filter that I applied to the tables using javascript does not match the filter displayed. The table displays data for the default filters.
I though if I just run the filter function on page load, things would work again. But turns out the filter function runs way before chrome resets the value of the select boxes from the cache. When I set the breakpoint and started debugging the progression on returning back to page is:
1. The select boxes resets to default values (i.e the order of the `<option>` tag)
2. The table filters based on the default values
3. Chrome at some point decides to readd the filter
How do you guys deal with this?
I am creating a Scan In and Out form in Acumatica as a custom screen. They are two separate screens and both are just a standard form.
They are both setup as follows: One field that is a selector where you select the Key ID of the data row you want to modify such as a Work Order. Once you click Scan In it will change the value of a field in that data row for the Key ID you selected let's say, the status field saying that it is being processed for Scan In button click and closed for the Scan Out button click.
My question is, is it possible to do this with just a click event. I mean the save button commits changes to the database but this does not have a save and is only changing one field of a specific data row.
If anyone has suggestions or can point me in the right direction that would be great! Again this is all in Acumatica so I feel the Graph or View will have to be modified?
Once in my company we did something similar, i know this is not the best option based on acumatica way, but what we did is to execute a direct SQL query from the action (in your case the click button) to update/insert something in database. I think the best option for you would be use Ajax, but i don't know if acumatica has this functionality.
In your action that is changing the status of the row, after changing the status, you can call an update to your view (ViewName.Update(targetRow)) that is used to populate the page with the information you are looking at. After you can programmatically trigger a page save using this.Actions.PressSave().
I have a Web page(aspx) with a large amount of JavaScript and Jquery(Used for managing the image scrolling for different sections like Featured products,Special Offers etc)
In the Featured Products section multiple product details are listed .
Each product has an associated text box where the user can enter a quantity that he wants to purchase.
When I try to get the value of a particular text box using JavaScript I get the default value of the text box instead of the value that is currently entered in the text box.
Using J Query also results in the default value being returned.
If the text box is moved to the beginning of the form section the currently entered value in the text box is returned as expected.
Thanks in advance for any tips as to why this is happening
Regards
Mathew
Could not find the actual problem. Anyway I am able to access the value that is entered in the textbox using Jquery.
Later I realised that the problem was occuring because the textbox was included in a slideshow
generated using Jquery Cycle2 plugin
I am trying this one to solve since last night but could not hence asking for help.
There are two pages, such as name.jsp and roll.jsp. In name.jsp there are two input text boxes and one checkbox.I entered data in two text boxes and i checked the check box , when i checked the check box i am going to roll.jsp and in roll.jsp 2 text boxes are present.
When I reached roll.jsp by clicking checkbox, I kept the link(name.jsp) on roll.jsp page and when i am clicking name.jsp I am not able to see my previously entered data on two textboxes. How can i achieve this? I am going to roll.jsp through a checkbox and i want to see all my previously entered data on name.jsp when i am clicking name.jsp hyperlink which is present in roll.jsp. How to achieve it? Two different forms are in these two pages.
Any help is much appreciated
When you have navigated away from page, all its input data will be lost. To remain it, you have to carry the data over either by request or through saving the data in a database/localstorage.
OR
You can try to use an iframe/SPA kind of behaviour. Where roll.jsp is loaded within the name.jsp either by iframe or using AJAX to bring in the content. That way you would not have navigated away from the page and thus the input data can still be used.
On event of click, if that checkbox is checked, make a call for roll.jsp, which will submit the value of current 2 textbox as well as it will show in roll.jsp.
For showing the previously entered values, accept using request.getParameter(string) and print that in roll.jsp.
Whatever the response will come from roll.jsp, print that is one div.
Hope your problem is solved.
In my asp.net MVC application I am using in place editors to allow users to edit fields without having a standard form view. Unfortunately, since I am using Linq to Sql combined with my data mapping layer I cannot just update one field at a time and instead need to send all fields over at once.
So the solution I came up with was to store all my model fields into hidden fields, and provide span tags that contain the visible data (these span tags become editable due to my jquery plugin). When a user triggers a save of their edits of a field, jquery then takes their value and places it in the hidden form, and sends the whole form to the server to commit via ajax.
When the data goes into the hidden field originally (page load) and into the span tags the data is properly encoded, but upon the user changing the data in the contenteditable span field, I just run
$("#hiddenfield").val($("#spanfield").html();
Am I opening any holes this method? Obviously the server also properly encodes stuff prior to database entry.
Assuming your server is properly detecting and dealing with XSS attempts, there's no way a malicious user could submit an attack for another user. Unless someone wants to hack themselves(?), it seems secure to me.
I find this approach pretty unsavory. I guess the overall soundness of this scheme depends on what fields you're actually populating this way --
For example, if you store fields that are supposed to be set only once (at the time of record creation) and never changed, this will allow a (malicious) user to change the field values mid-stream by editing a hidden field before posting (very easy to do, for example, with Firebug).
There's no difference here than if you were providing visible input fields and having that form submitted. Simply shuffling the data into hidden fields vs. visible ones would not make a difference.