NetTalk Central

Author Topic: Button that looks like Cancel but behaves like Save  (Read 2360 times)

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Button that looks like Cancel but behaves like Save
« on: June 11, 2018, 11:57:50 AM »
Hi,
I need a button next to my Save button in a form that looks like a Cancel button but behaves like a save.
The reason for this is that when the user cancels, the validateall needs to be executed and also the data from the input fields must be posted to the server as wel.

I have created a save button but now I need to find out which one of the save buttons is being used and I don't want to check on the _buttontext_ parameter.
Also, the server side code cannot be used because the code first executes the validate part of the cycle.


Cheers,
Rene
« Last Edit: June 11, 2018, 10:07:59 PM by Rene Simons »
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11158
    • View Profile
Re: Button that looks like Cancel but behaves like Save
« Reply #1 on: June 13, 2018, 12:35:40 AM »
Hi Rene,

>> I need a button next to my Save button in a form that looks like a Cancel button but behaves like a save.

that's a somewhat bizarre request, but ok....

>> The reason for this is that when the user cancels, the validateall needs to be executed and also the data from the input fields must be posted to the server as well.

sounds more like a "save button without the disk write?"

>> I have created a save button but now I need to find out which one of the save buttons is being used and I don't want to check on the _buttontext_ parameter.

why not?

>> Also, the server side code cannot be used because the code first executes the validate part of the cycle.

Sure, the "server side code" of a "save" button happens on a separate thread,  at the "same time" so that's not gonna help you.

but I can't help but feel you're describing the solution here, not the actual problem. What is the _actual_ problem you are trying to solve?

cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Button that looks like Cancel but behaves like Save
« Reply #2 on: June 14, 2018, 02:09:43 AM »
>>>> I need a button next to my Save button in a form that looks like a Cancel button but behaves like a save.
>>that's a somewhat bizarre request, but ok....

I can understand that.The situation is that I am creating an app that interacts with programs on an AS/400 system.
Instead of showing the "green screen" some measurements have been made to have the displaying of the green screen create an sql-resultset


>>>> The reason for this is that when the user cancels, the validateall needs to be executed and also the data from the input fields must be posted to the server as well.
>>sounds more like a "save button without the disk write?"
To me the validateall takes care of the communication between the webserver and the back-end (as/400). Therefore I need a cancel button that doesn't act like a cancel. The data from the browser must still be sent to the ValidateAll. The back-end program must get a "notification" that is has to end its process.

>>>> I have created a save button but now I need to find out which one of the save buttons is being used and I don't want to check on the _buttontext_ parameter.
>>why not?
Now I know I have no other option. I do check the _buttontext_ now. To make it look like a Cancel or Exit button, I can apply some CSS.

>>>> Also, the server side code cannot be used because the code first executes the validate part of the cycle.
>> Sure, the "server side code" of a "save" button happens on a separate thread,  at the "same time" so that's not gonna help you.
I left that route behind me and solve it by checking the _buttontext_  in the ValidateAll.

>>but I can't help but feel you're describing the solution here, not the actual problem. What is the _actual_ problem you are trying to solve?
I think writing it all down was part of the solution process.

Thanks for your time.

Ren
Rene Simons
NT14.14