Prevent duplicate update of CFgrid - coldfusion

I have a CFgrid with selectMode="Edit". Again I have an update method binded to the cfgrid via my cfc. However I am ble to update the grid with duplicate values. I can prevent the db from updating by chking for existing record but I wanted to let the user be thrown with a message that his update was not succesful. In this case he will only know of his update not being succesfull only after he has refreshed the page only to find the old value still exist.
I wanted to know if there is any event within the cfgrid which I can trigger to show the user that his update is trying duplicate the data and cannot be completed.

You haven't posted any code, but I am guessing you are using an HTML grid with the onChange attribute to trigger the edit? If that is the case, then you can also use the onError attribute and then just have your CFC throw an error if the data is not satisfactory with cfthrow. Then in your onError handler, you can handle the error as you please. You can find more information about working with HTML grids in CF9 here

Related

Oracle apex form doesent INSERT/UPDATE or Create entry in database

Hi everyone so I have a problem with Oracle Apex, I created a master-detail with a from and everything worked fine. Then I created another page within the same app but nothing connected to the page mentioned before, and now nothing on the first page works. When I try to create an entry the form opens I can type anything in and when I click "create" the form closes and nothing happens. Nothing is inserted into the database, edit also doesn't work as well ass deletes everything looks perfect till the form closes, the region refreshes but nothing actually happens.
No error shows up in the app or in the console/debugger
I checked the form processes and the DML is there.
Tried to manually set value in SQL Workshop and that works, I'm able to manually insert rows but not through the form.
Please help this is for my final project and I need this to work.
Thank you in advance!
Edit: 4) Also saw that no button works on the form. I have a combination of form + interactive grid and the grid usualy has like a page navigation buttons for previous/ next and those dont work aswell. So maybe i try deleting and re creating all the buttons?
EDIT2: Managed to fix it, and found that I was somehow missing the Close Dialog process in my form. Added it and now everything works!
Close dialog process in the form page was missing, recreated it from a different form, and now everything works!

Oracle APEX: Session state protection violation error on Display Only page item

I'm trying to update Display Only page item with a dynamic action on one select lists and want to display the value in that display only item.
My code works and page item gets set but once I try to submit the page I get an error: Session state protection violation: This may be caused by manual alteration of protected page item P1_TEST_ITEM. If you are unsure what caused this error, please contact the application administrator for assistance.
I know for hidden items I can just turn off the Value Protected but that is different for Display Only page items as there is no option to turn off value protected. How can I fix the issue?
There is a doc on MOS (1461271.1) explaining this is expected behavior since apex 4.1.1
Here are some workarounds
Define item as text
Set Advanced > Custom Attributes to readonly OR Advanced > CSS Classes to apex_disabled
Alternatively, if you want to use Read Only, then you could use a computation on page submit instead of a dynamic action.
Simply turn off "Send On Page Submit" under settings of that item and it should work.

How to update content in a block after flagging event without page reload?

Hy, I'm fairly new to Drupal 8. I have a custom entity type called Event and using the Flag module I added the option to "Favorite the event" and finally I have a custom block which displays the number of Events each User has favorited. Everytime a user "favorites" a new event the block obviously shows the old value. I have set up cache invalidation, so if the user refreshes the page he will see the updated/correct number. Now my question is, how can I update the block's number without refreshing the page. I can't find an easy example anywhere. The Flag module's docs are outdated or incomplete and I think the answer lies in subscribing to the Flagging event and performing actions there, I just don't know how to include or perform a javascript action ("if it's needed, I assume it is). Any help would be greatly appreciated.
Use Ajax Command on block and don't forget to attach ajax.core library to block.

Form params not getting passed

What are some reasons form params would not show up in the console after form submit? I have a form with nested attributes, that has been working fine. Suddenly, the nested params stopped saving to the database. Running debugger in the create action reveals that the nested params are not being sent with the form.
Strong params are set correctly, and were working before.
Im using .new in the controller action to build an instance of the nested objects
I did end up building the id and name attributes of the inputs manually due to some functionality I was looking for...but, again...this was already working.
Im using rails 4.0.2.
Are there any other aspects I could be missing as to why my nested fields are not showing up in the debugger params?
Turns out this error was from a misplaced html closing tag. Sometimes the form elements got passed and other times they didn't. It was a hard one to track down, because I was looking at active record and rails...when I should have looked at html as well. I finally found it because I was debugging the code in the browser and noticed that the form elements were outside of the form tag.

property sheet data validation

When the user clicks the OK or APPLY button on a property sheet and the program determines data on some page is invalid, how can I cause the page containing the error to be displayed along with a message box describing the error?
Currently the procedure doing the validation does the following while processing the PSN_APPLY notification.
MessageBox (hDlg, "Data must be positive!", "Error", MB_OK);
SetWindowLong (hDlg, DWL_MSGRESULT, PSNRET_INVALID);
This works ok if the page doing the validation (A) is currently displayed but if some other page (B) is being displayed, the message box appears with that page (B) being displayed, then when the message box is answered, the page with the validation error (A) is displayed. I thought about setting some flag so that when that page (A) gets the PSN_SETACTIVE notification it displays the message box but that seems kind of hokey.
Win32 API in c++, no MFC, no NET, nothing fancy.
I think the problem is in the design of your validation and it's presentation.
Am I right in thinking that you iterate through your property sheets, validate them and display a message box if something is awry? Because of course, what you have witnessed will happen, if I am on property page 3 and I wrote crap in to a field on property page 1.
The easiest solution is, when validating, note which property page the field in question is, and set that one active if the user has written crap in to one of your fields. This seems the fastest way possible.
Also, rather than spring up an annoying message box, reserve some room beneath the property pages to display a textual (red or otherwise) warning as to why, and then change to the appropriate property page, and highlight the offending control. Your validation routine can do this nice and easily as it loops through.
Even better, don't stop at the first error. One thing I HATE is correcting one field that I think is the only issue, only to be told every time I hit "OK" or "SUBMIT" that there's something else I missed.
I seriously think you should consider going the extra mile here... loop through ALL controls, and add all invalid ones to a list. Then change each offending control's background colour, tab colour etc... Then the user can work through and correct, no matter how many errors he or she made.