Hi,
I have a form that includes field texts and 1 dropdown combobox. I want to save the data to the databse, the values filled in the field texts are working and saving to the databse. However the dropdown does not save the selected option to the database. How can i manage to save both the fields texts(wich are already working) and the dropdown option to the database? I have 2 entitys. 1 is a normal entity and for the dropdown i use a static enity
Hello guys,
@Daniel, yesterday at night I responded to a Samed's private message and I sent him the OML with those exact same corrections :)
Samed told me that he managed to get it working (I forgot to respond here).
@Samed, Daniel's suggestion is indeed a good approach. OutSystems learning paths are a really great way to evolve with the platform. I believe that you should follow this suggestion.
I'm glad that you managed to solve your issue.
You're most welcome!
Kind regards,
Rui Barradas
Have you checked https://success.outsystems.com/Documentation/11/Developing_an_Application/Design_UI/Patterns/Using_Traditional_Web_Patterns/Controls/Dropdown_Select or https://www.outsystems.com/learn/lesson/1958/demo-how-to-use-the-dropdown-widget?
Hi Samed,
Did you search the forum for a solution, as there are multiple older discussions on the same topic, some of them are:
Regards,
Daniel
Daniël Kuhlmann wrote:
Hi Daniel,
I have read the forums above. I tried to do the same things, however it still is not working. My setup is as the pictures i posted above, everywhere where i look they say to do it like that. I think that i am doing something wrong with mine actions.
Hello Samed,
For the field texts, you should have these fields created into an Entity (referring to Email and Mobiel fields).
In this entity, you should also have a Foreign Key (KeuzeId), pointing to your Static Entity Keuze. This will allow you to save the Id associated to the option that the user selected.
So, when you press the Save button, you need to pass the Id associated to your dropdown (Keuze2.Id) to that action and save this value in the database Entity where you save the other fields.
Let me know if you managed to do it.
Rui Barradas wrote:
I have tried to do that, i think the things you mentioned above i already had. Can you check on the image that i posted if the settings are as you mentioned
I checked the image before to see your variables, but I can't verify if you have the Foreign Key to Keuze Entity in the entity where you want to save the information.
Can you please verify if you do?
That's the field where you need to save the Id binded to your dropdown.
I think this is what you wanted to see right? As you can see, the KeuzeId is as a Foreign Key in Gegevens. I think i have to change something on the server action or somehting on the logic side?
Samed Gurses wrote:
Hi Sames,
Maybe if you share details on the action that writes the record, especially how all attributes are assigned.
Most likely you are not assigning a value to Gegevens.KeuzeId.
Thank you for your reply.
Here are the details, i hope i coverd all the needed details!
This is the assign:
This is the SaveonClick action in interface:
This is the action in Logic:
Hello again Samed,
Thank you for sharing these images.
Yes, that's what I wanted to see and it seems correct.
Why do you have Keuze and KeuzeId fields? Is Keuze another field that you have?
According to what I'm seeing, you just need to validate your Server Action logic in order to guarantee that you're saving the Id associated to your dropdown in the database.
Hi Rui,
The Keuze is just a text field, i did this because i could not fix the dropdown voor Keuze. So i Keuze is a text field and KeuzeId is the dropdown where we talking about. I also think it is something in the action logic but i just can not see the problem. If you look at the picture below, it says that the Keuze2 input is never used, could this be a problem?
Here are my observations:
On screenshot 1, if the form is in error, you silently exit the action, no feedback to user. So maybe no data ia added all, but you are just not informed.
The second assignment is wrong, needs to be:
GetGegevensById.List.Current.Gegevens.KeuzeId = Keuze2.Id
The GetGegevensById.List.Current.Gegevens should be passed as input to Opslaan action.
I see no reference to Opslaan action being called.
I changed the assignment and tried it again. But is somehow does not work either. As i mentioned above, i get this warning:
Is it possible that this is THE problem?
Cheers
Your screenshots confuse me, sometimes you show the properties but I think they don't belong to the server action shown in the screenshot.
Could you share the oml?
Here you go, sorry for the confusions.
Samed I sent you a private message.
I made the minimal change to your module to get it working.
On Screen1, i changed the variable on the dropdown1 widget from Keuze2 to GetGegevesnsById.List.CurrentGegevens.KeuzeId:
In Client Action SaveOnClick, i removed the assign that set the Id and KeuzeId on the current record, there is no need for that they are already assigned in the form.
In Sla_Op server action I removed the second Keuze2 input parameter, no need for that, the Gegevens record input parameter has all the values entered already.
Note: this is the minimal change to get your code working. But honestly there is so much that ain't up to how I would code your application.
As you are new to OutSystems, I would strongly advice to follow the great, fun and free learning guided paths on the outsystems.com/learn site. This is a time investment which will pay off 100%, as you will get a better grasp of all the OutSystems concepts and what OutSystems can do for you.
I would say that 99% of what you coded code have been generated by OutSystems scaffolding features.
See attached update version of your module.
Thank you guys @Daniel and @Rui. With help of both of you i managed to fix it. Thank you Daniel i will defenitly check the online learning courses of Outsystems!
You welcome, happy coding & learning
@Rui, I did the same, provided Samed an updated a 99.oml. also had some PM with him.
@Samed, lucky guy having two OutSystems experts helping you out. As I noticed you tried to mark both mine and Rui's replies as solution. This is in the current version of OutSystems Forum not possible. It is one of the features that I hope will become available (ok I am pretty sure it will be) with the revamped Forum that OutSystems is working on right now.
So perfectly cool with you picking Rui's last reply as a solution!
Thanks mate!
About those "fresh news" (at least for me), related with marking 2 posts as a solution, it is an amazing feature! Because sometimes there are some complementary answers and marking both as solution could be the perfect scenario.
Again, thank you for letting me have this one :)