dinsdag 18 januari 2011

Houston, now I have a problem

k... here goes... This one caught my eye before. And I had this issue now. So I thought like, while I am on the subject noticing the problem. Lets just write it down and explain what happends.

The current way I am making these forms is that they have states. As in, what are we doing with this form? Are we adding a new record? Are we editing an existing record?

This state is inserted on the form itself. Meaning, there is a hidden field that contains an "action" which is Add or Edit. With edit there is not much of a problem there. However, with adding there is.

The thing that I want to do different here is to ADD the record first and Edit it later on. Normally this is not behavior on how websystems work. Because they just tell you "your thing has been created, or send" and then you need to click somewhere to edit it later on. This is probably done to prevent the issue I am addressing here right now.

But seriously, this is just another click... and we already click way too much. I like to prevent this from happening. Thus the system i initially went for is existing. However, now I have the problem that the same exact record gets inserted twice when hitting the F5 key after pressing Save...

For me, this makes sense why this is happening. Since the form states are being send as they were the previous time the Save button was clicked. So this means that the action I am sending back and forth is still the same ("ADD").

I can come up with multiple ways to solve this issue. Since its just a matter of checking "if the data is already there"... But this also means I need to do this on every inserts I have done so far. Which kinda stinks at this point since I have made alot already. But nevertheless, I just need to clean this little issue up somewhere tomorrow.

Geen opmerkingen:

Een reactie posten