Re : Tutorial about  "alert messages".

Re : Tutorial about  "alert messages".

  
Hi everyone,

Can anyone show me a tutorial about "confirm messages"  and "alert messages"?

About this messages, what i'm looking for is something to show me how to do the messages: "do you really want to delete this file? Yes or no?" or something like " the "name_field" can't have that value, please correct the following".

Thanks everyone.
Hi Nuno.

We're glad you asked. Take a look at our Form Validations tutorial and see if it helps.

Regards, and good luck!

Paulo Tavares

Hi Paulo,

Thanks for the reply.

I'll take a look, and if i have any doubts, i will let you know.

Thanks.

Hi Paul,

I was reading the tutorial you sent me, and i have a doubt.

What i'm trying to do, regarding this validation form, is check if the number that i puted in the textbox number 2 is bigger than number 1.

In my if condition, i have no doubt, because i made the query like: field 2 > field 1. (EditRecord1.Record.TabRegTrad.NumAccoes2 > EditRecord1.Record.TabRegTrad.NumAccoes1)

My problem is in the assign part.


This is what i have, but i don't think it's correct, because it's not working.

Can you point me in the right direction in this problem?

Thanks.

Nuno
Hi Nuno.

I'm unable to see what is wrong with the coude, just from your image.

What would help would be for you to let us know:

1 - What were you expecting to happen (in each case - when it's valid, and when it's not valid);
2 - What is actually happening, for you to say that is not working;
3 - Attach the eSpace to your next post, so that someone might take a look at it and explain it better.

Regards,

Paulo Tavares

Hi Paul,

Ok, i will try to explain my self a little bit better.

1 - What were you expecting to happen (in each case - when it's valid, and when it's not valid);
What i was trying to do is check is the field_2 is bigger then the field_1 (
EditRecord1.Record.TabRegTrad.NumAccoes2 > EditRecord1.Record.TabRegTrad.NumAccoes1): This is what i have in my if condition (i don't know if it should be something like this or not, but it seems right to me).

2 - What is actually happening, for you to say that is not working;
If the the condition field_2 > field_1, then it should insert the record; else it should send a message to the user saying that the field_1, should be smaller then the field_2 (or that the field_2 should be bigger then the field_1)
If in the field_2 i put a smaller value, it inserts the record, without showing the message.

3 - Attach the eSpace to your next post, so that someone might take a look at it and explain it better.

Done.

Thanks.

Nuno



I've made one change in my "if", that i think it's more appropriate, but it still doesn't work.

This is what i changed to: "TabRegTrad_NumAccoes2.TypedValue >TabRegTrad_NumAccoes1.TypedValue"
Hi Nuno.

Here follows my suggestion, from reading your code:



I have to admit that I wasn't able to publish it here, for lack of a running server at the moment. Hewever, this will hopefully get you going in the right direction.

Furthermore, whenever you have such problems, one good way to try and understand how things work is to use our Debugger, and following the flow step by step you'll be able to understand what's going on, and why the application is failing. It's a good way to learn hands-on how the eSpace is running.

Let us know if this helps.

Regards,

Paulo Tavares

By the way Paul, accordin to the tutorial you gave, there's two if elements?

Can you explain me why?

What condition should we put in the second one - "Valid?" ?

Thanks.

Nuno

Hi Paul,

I was reading again the tutorial you gave me, and has you can by the pos before this one, i was asking why did they use 2 "If elements".

I eliminated the second "if element" from my space, and now it's something like this.



Now it kind of works.... When i do the condition that fails, what it does, is the two textboxes get red, and when i click on the second texbox, it shows the message.

But if i correct the problem, this is, is if the field_2 > field_1, it keeps showing the same.

Do you know why?

Thank you Paul... AGAIN.

Thanks again.
Hi Nuno.

Yes, there are two ifs. The first one sees whether the input values are valid.

The Assign must mark the widgets as invalid.

Then the second "If" will see if the WIDGETS are valid.

You are right, though. In such a simple validation, you could have done it like this:



However, if later on you want to change the validation condition, the code is already refactored. As long as you do all the validations you need beforehand, the last IF - the one which checks if the WIDGETS are valid or not - will always work.



Your second IF should contain



since you only want it to be TRUE when

TabRegTrad_NumAccoes1 is Valid

and

TabRegTrad_NumAccoes2 is Valid

In all other situations, it should go to the false branch.

Let us know if this helps, and let me know if you understood the explanation, since this is crucial for almost all logic in Service Studio.  If I may, let me give you one suggestion.

If I recall correctly, you've been working with OutSystems for some months now. By this time, you should already have done the first Developer Course, and most of these subjects should be clearer, I'd say.

If you haven't had the time to do it, I strongly recommend that you take the time to do the Developer Course 1 of the Agile Platform, from the beginning to the end. It will take you one day, maximum, but you will feel much more comfortable and sure of yourself when developing in OutSystems from here on. :) Trust me, it does wonders.

If you have had the time to take the first Developer Course from beginning to end, then please let us know, because that means we need to improve our materials, or explain things better, and we could definitely benefit from your inputs in terms of what to improve. :)

I hope you don't take this the wrong way. Let me know if you have more questions, and if you got your application to work.

Regards,

Paulo Tavares

[EDIT: You beat me to it :) You had already posted this while I was still writing the post. Good luck with the rest of your app!]

Now it kind of works.... When i do the condition that fails, what it does, is the two textboxes get red, and when i click on the second texbox, it shows the message.

But if i correct the problem, this is, is if the field_2 > field_1, it keeps showing the same.

Do you know why?
HI Nuno.

Sorry, but I don't understand what you're going through just through words, since I haven't been able to publish the application and actually work with it.

If you could send us some screenshots describing what you're experiencing, what's wrong, and what you were expecting - and the eSpace, again - maybe i could help you better. Let me see what you did.

Regards,

Paulo Tavares
Hi Paul,

I've followed one of your previous advices and i indeed have done the first Developer Course from beginning to end. 

Like in any other language somethings are easy to achieve and others aren't. Not all tutorials cover all the information you want.  Somethings are pretty simple, but when it gets more complicated, that last 5% has to be done with help.

One other problem that is agravating my learning, is that i don't use this OutSystems, all the time. I can say it's almost on my free time, that i use it.

Now regarding your explanation, i understood most of them, but there is something i have not understood.

Let's look at your space, with the 3 "if elements" and the final one called "Válidos".

Let's say for example i want to make tree validations:

1) Can be the one i've used: field_2 > field_1;

2) see if the field_3 is a correct mail field, this is, if it has the "@". (like the tutorial).

3) let's say i want to check if the phone number field, only contains numbers.


Acoording to the scheme, all of this 3 checks will be made, and then one final (Válidos) that will decide if it will proceed to the end, in case of false or if it will insert the record in case that it's true.

My question is: what should be the condintion to the final "if element" (Válidos).

Befor you answer, i will tell what i think.

I think i have to have to check if the 3 conditions are valid, right? In order to insert the record the 3 of them has to be valid, and it won't insert if they aren't.

Can i deduce, that when i one condition to check, i can use only one "if element" and when i have 2 or more i have to use more "if elements"?

I hope i have explain myself.

Thanks Paul.


Ok, Paul.

I'll explain what is happening now.



As you can see, i've filled the fields, in order to the condition to be false (field_1 > field_2).

And when i press the insert button, this is what it shows.

The problem is when i make a correction to the field_2.  If i put "698989889" in the field_2, the condition should be valide now and insert the record, but it doesn't.

It keeps showing the same message, even i pressed the inset button.


Hi Nuno.

Thank you for clearing it all up.

To start off, the reason why the error message only shows on the second input is because in the ASSIGN you're only setting the second input's validation message.

Regarding the deduction you made... Well, that could be one way to do it, yes, but I would recommend you doing it as suggested in the tutorial. In the first IF(s), you check the conditions you want to check, and in the final IF you check if the specific WIDGETS are valid.

Answering your question regarding the 3 validations, the final IF condition should simply be:

field1.Valid and field2.Valid and field3.Valid and fieldPhone.Valid

Because in the previous IFs you would already have done:
  • field2 > field1
  • EmailAddressValidate(field3)
And I would hope that, if your fieldPhone is a Phone Number data type, and as such the validation would be automatic.

In regards to what you are experiencing, without seeing your eSpace, the only thing I could suggest is that you have to set the widgets as being VALID if they actually are, so that the second time around, when you go through the flow, they don't keep the "VALID = False" that you had set them first.

Let me know if this helps.

Regards,

Paulo Tavares
Hi Nuno.

Apparently the last IF should just be

editrecord.Valid

Since that's the master validator. The way I was suggesting wasn't right at all, since it was skipping some of the built-in validations - my bad.

This will work as long as all inputs have the Parent Edit Record set to the Edit Record.

Regarding the thing I mentioned about setting Valid to true, well, that's probably not right as well. Thanks to Gustavo Guerra for pointing it out to me.

I guess you should just attach your eSpace again here so that we can see what's going on.

Regards,

Paulo Tavares
Hi Paul,

Sorry for not responding to you sooner, my i'm on holidays until 30th of August.

The explanation of your first post, i understood it completely. It actually made sense of what i was expecting you anwser would be.

Now about the second post.... it only made me confused :(

You say: "Apparently the last IF should just be

editrecord.Valid"

I only have one If... so it can't be the "last" is the only.


"Since that's the master validator. The way I was suggesting wasn't right at all, since it was skipping some of the built-in validations - my bad.
This will work as long as all inputs have the Parent Edit Record set to the Edit Record.
"

Hum? Is this for my case?

Thanks again Paul. You have been an excelent help.

Nuno

Hi Paul,

How are you?

I was wondering if we could finish what we started, regarding my problem.

Thanks.

Nuno
Hi Nuno.

How are you?

Regarding your questions, if you use 2 IFs, the second one only needs to be what I mentioned, since it is the master validator. The implementation should be similar to what I have mentioned in previous posts, with the pictures I attached. If you only use one IF, then the implementation is different than what I mentioned previously.

Regarding the error you're having right now, I don't know what could be wrong. If you want to send us the eSpace again, and describe what the wrong behavior is - and what you expected it to be - maybe someone can help.

Regards,

Paulo Tavares

Hi Paul,

I will try explain myself the best i know.

My design is still the same has the image below.

.

With this i have a problem.



Has you can see from the image above, it's working perfectly because it is detecting that the second field should be bigger then the first one.

So, up here it's fine.

The problem is when i correct the situation, meaning, let's say that i input into the second field the value 9999999 (which is bigger then the first one) i still keep getting this message.

I should have something what would have to take to the first condition.

How do i do something like that?

Thanks again.

Nuno

PS- my space is in attachement.
Hi Nuno.

I'm unable to find the design you mentioned  in your eSpace. I strongly recommend that you go back to the previous logic, since that is the way the validation should be done. Your current add_teste screen, and the Save_record action do not validate anything, because regardless of it being correct or not, you'll always create a record and go back to the show_regtrad screen.

Is this the latest eSpace version you have? If so, I suggest you re-do the validation logic based on the tutorial and we can start from there.

Regards,
Paulo Tavares
Hi Paulo,

I don't know what to say,  but something strange is happening here. I'm attaching my current espace.

My save record space should be the same has of first image in my previous post. (with only one if).

"Your current add_teste screen, and the Save_record action do not validate anything, because regardless of it being correct or not, you'll always create a record and go back to the show_regtrad screen." - How can this be?

If the IF condition fails, it gives me the error and doesn't insert the record how do say it insert regardless of what happens?




Hi Nuno.

The previous eSpace you had sent had the following Save_record action, which was always saving the record:

Save Record

Regarding your current eSpace, try changing the IF condition to

EditRecord1.Record.TabRegTrad.NumAccoes2 > EditRecord1.Record.TabRegTrad.NumAccoes1

Let us know how it works.

Regards,

Paulo Tavares
Hi Paulo,

Let me start by apologizing for sending the wrong space. That was something that i was just trying.

Now, I've made the changes you recommend and now it works, but i don't quiet understand why.

Can you explain me two things, because i'm happy that my application is now working, but i would like to understand why, so i would really appreciate if you could explain this:

1) why is it working now? What was wrong with my condition?

2) Should i use a second if?  I think i don't have to use, because this is kind of simple.


I'm sorry for taking so much time understanding this, but sometimes i'm a little bit slow.


  Again, thanks a lot Paulo.
Hi Nuno!

Glad it is working. Well, first of all, I was checking the tutorial, worried that it might have been wrong as well, but in the tutorial he uses the EditRecord value :)

The issue with using the TypedValue is that the TypedValue is exactly that - the value the user typed. Being the value that the user typed, it is a string, because you could write any text in the Text Box. That's why when you make the comparison [String] > [String], it doens't really work!

Regarding having two IFs, if you're just going to have this validation, you're fine with just that IF, no need to add an extra one.

Hope this is clear, and I'm glad wee finally solved it!

Regards,

Paulo Tavares
Hi Paulo,

But there is something i don't understand.


"(...)but in the tutorial he uses the EditRecord value :)" yes in the tutorial is correct, but if i might add, in the tutorial it doesn't specify what should be the condition of the "final IF". That's why i was always confused with that.

"The issue with using the TypedValue is that the TypedValue is exactly that - the value the user typed. Being the value that the user typed, it is a string, because you could write any text in the Text Box. That's why when you make the comparison [String] > [String], it doens't really work!"

But it kind of working, because whenever i imputed a smaller value to the second field it pooped out the message i wanted.

Well anyway, thank you very much.

I know i was a pain in the a...., so i really thank you for helping me.

Thanks.

Nuno
Hi Nuno.

Just to close this issue:

"(...)but in the tutorial he uses the EditRecord value :)" yes in the tutorial is correct, but if i might add, in the tutorial it doesn't specify what should be the condition of the "final IF". That's why i was always confused with that.

You're right. The tutorials are now different, so hopefully you shouldn't run into the same issue again.

"The issue with using the TypedValue is that the TypedValue is exactly that - the value the user typed. Being the value that the user typed, it is a string, because you could write any text in the Text Box. That's why when you make the comparison [String] > [String], it doens't really work!"
But it kind of working, because whenever i imputed a smaller value to the second field it pooped out the message i wanted.

Well... It isn't wornking if, on the other hand, when you input a larger value it also pops up the message, right? :) That is like saying that if we had there if(false) it was working ;)

I don't know what the result of the evaluation of the expression "[string] < [string]" is, but it obviously isn't what we want. That's why it seemed to work in one scenario, and not in the other one.

Regards,

Paulo Tavares


Ok Paulo.

Again, thank you very much.