We have moved to a new Sailfish OS Forum. Please start new discussions there.
0

Cancel onAccepted [answered]

asked 2014-08-22 11:06:35 +0300

FloR707 gravatar image

updated 2014-08-22 13:16:04 +0300

Mariusmssj gravatar image

Hi,

I am wondering if it is possible to stop accepting a Dialog. Before saving the data I would like to check them and if there is an error I want to stay on the Dialog page. The documentation tells me that onDone is executed before onAccepted but how do I manage to stay on the page?

Thanks

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by eric
close date 2014-08-25 16:40:05.038768

Comments

One way to do it is use onDone (called before onAccepted or onRejected), validate input and set canAccept property accordingly.

koudi ( 2014-08-22 11:26:33 +0300 )edit

I already tried that. All that happens is that I get a grey layer on top of everything but the dialogue still closes. My plan was to keep the user on the page until a valid input was done or he rejects.

What I did is setting canAccept = false when my check logic returns an error. I guessed that is the way to do it. Is there another way?

FloR707 ( 2014-08-22 15:38:58 +0300 )edit

If you can check them "real-time" ? Default canAccept to false and when everything is ok set canAccept to true?

Atleast usable with validator checks in TextField (acceptableInput)

kimmoli ( 2014-08-22 23:40:43 +0300 )edit

You might try calling reject() in onDone (haven't tried).

koudi ( 2014-08-23 11:47:46 +0300 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2014-08-23 23:13:12 +0300

FloR707 gravatar image

Okay I figured it out. The canAccept is the right tool but I had placed it wrong. I am not sure what the onDone feature was planned for but it is no help in checking the user input. To make sure the user can only accept a Dialog the canAccept needs to be placed right in the Dialog element and be connected to your check routine.

Dialog { id: userInput canAccept: checkFunctionBool() || inputFiel.text != "" ... }

edit flag offensive delete publish link more

Question tools

Follow
2 followers

Stats

Asked: 2014-08-22 11:06:35 +0300

Seen: 165 times

Last updated: Aug 23 '14