User opens one screen in two browser tabs and press update button within milliseconds - postgresql

I am running into one issue. Any help would be appreciated.
I am using PostgreSQL as back end.
The issue is: User opens one screen in two tabs and press update button within a second.
Example - table fields - id - is_posted
I have a flag on the table which I am setting it to true - is_posted = true and after setting this flag to true I have a trigger which inserts few records in other tables. If is_posted = true then I am not allowing the user to update that record again.
If a user clicks 'Update' button in one tab and after 1 - 2 seconds clicks 'Update' button on other tab then I get updated value and easily throw validation message that "Record already updated".
But if a user follows the same process but within milliseconds, then I do not get the updated data and record get updated twice. And it is creating multiple records in other tables which is leading to create bad data.
Kindly suggest.
Thanks,

Related

FileMaker: Allow the user to filter the table and then revert back to showing all records

I've just started using FileMaker Pro. I have created a spreadsheet in Excel which I'm basically trying to recreate in FileMaker.
I have my table (or, Portal) set up with data. Above the table I have 3 drop down fields, which pull their values from the table below. Based off of the value of the drop down fields, I want a GO button that will filer all of the table items to match what is in the 3 drop downs.
Image the table contains Car, Colour, Year. If the user selects Mercedes, Red, 1980 from the 3 drop down fields, I want the table to only show results that match those fields.
Ideally I'd like a button to trigger this action, and another button that resets it so it shows all results.
I can see that you can filter the table when you double click it, but this seems to set it to permanently filter. I want a button to do it basically.
Would appreciate the help! Thanks

Form validation of pair of fields

I have a html form which contains a pair of project/hours fields(the project being a select field and hours an input field) that i need to validate in my form.There are about 5 of those pairs. I want the user to be notified of an incorrect submission when one of the following happens: there is no project select and hours filled in any pair;when a project is select but hours aren't defined for that project and vice-versa.
How would I go about validating my fields in a pair?
Assuming a button is clicked by the user when the user thinks he is finished, you can check the selects and inputs with Jquery. If something is not ok, then tell the user and prevent the button from doing anything else.

How to refresh a rowrepeater in sapui5

I have developed a small application in which I have a row repeater where I will display the recently created records.
Suppose I have some 150 records in a row repeater.
Now the problem is I scroll down to see the 100th record in the row repeater
and after viewing the 100th record I will go back by clicking on back button.
Now if I again click on the row repeater the page is not displaying from the starting record by default its showing from the 100th record means I again need to scroll up to view the 0th record.
How can I overcome this issue?
You can
ensure that the RowRepeater (or it's surrounding view) is destroyed on back and recreated on enter (only way known to me to handle your requirement with UI5)
use jQuery.scrollTop() on re-entering the view with your row repeater
var oRR = sap.ui.getCore().byId("myRowRepeater");
jQuery(".sapUiRrPage", oRR.getDomRef()).scrollTop();

How to add a Time dependent trigger in PostgreSQL?

I'm confused and clueless on how to:
Add a trigger to a postgresql db once the db has been set up, i.e. adding a trigger by clicking a hyperlink
Write a trigger function so that it deletes a specific row after a week has passed since the trigger was written.
This is the sequence once events just for clarity
Admin sees entry in db via a php generated html page.
Admin clicks 'approve' hyperlink next to db entry.
This creates a trigger in the db to delete that specific row after 1 week has passed.
I need help with step 3
Would an alternative way of doing this be to have a trigger on the table, so that when a row is inserted a new trigger is created which checks the value of an 'approved' column for that row. When the Admin clicks 'approve' in the html page the word 'yes' is inserted to the 'approved' column for that row. The trigger will detect this and add a new trigger to delete the row after a week?
As you can tell i'm really not sure which way to do it and how to do it so any feedback would be much appreciated. Thanks.
Simple: Store an expiration date for the url in your db, only retrieve currently valid records (you can use a view for this) in your select, and delete expired urls from time to time.
You can't use a trigger though. pgAgent or cron could be used to start a cleanup process though.

Extjs form submitting multiple times

I'm using a form for edit some records. Each time When Edit link is clicked i'm loading one record data into form, changing the values and updating, its worked fine for the first time.
When i load another record data into form and update it, the present record is updating and the previous record is also updating with the new data.
If i update 3 rows after that when updated the 4th row, 4th row and previous 3 are updating with new data entered for 4th row.
I think form is submitting multiple times,
I used form reset property each time loading the values, but its not worked.
How to do this Please help me
Are you holding your formpanel into a Ext.Window component ? Check if the window is actually closed or hidden. Try putting closeAction: 'close' in your window config.