Condition help - writing the correct expression to only act on the data in a particular row rather than 'first item' in table

I have a form where the user inputs a list of drugs they are currently taking. Under each Rich Text Editor response box there is a dropdown menu which the user indicates through it whether they have completed the response, or whether or not its not applicable to them. When the user selects Completed or NA the RTE above it becomes disabled as to lock in their response. All this is working fine.

The issue I have is - when the user comes back to the reseted form to complete it again for a new drug, the RTE is disabled because its picking up the Complete or NA status of the ‘first item’ data submitted previously. I’m struggling to come up with the right expression for the condition so its not reading the ‘first item’ in the table, but instead only scanning to see if Complete or NA is present for the current drug entry that is about to be entered, if that makes sense.

This is the front end form and drop down ‘status’ selection menu:

Here is my conditional for disabling the RTE. As explained above, I think its disabling this because it’s scanning any first instance of the selection ‘Yes Lock Section’ or ‘Not applicable’

The question is, instead of ‘first item’, what’s the right expression so it only picks up the selection corresponding to the row of data its dealing with at the time instead of any first instance that appears in the table?

You’re probably going to want to use :filtered to “target” the item you’re looking for

Hi there, @JS7319… if I understand your post correctly, it seems like the issue could be related to the fact that you are doing searches in your condition instead of referring to something like the current page’s or parent group’s item.

Based on that statement, it sounds like the user might be returning to the form by selecting an existing item from a table, and the form is pre-populated with the selection’s data. If that is the case, you shouldn’t have to search for anything because you should be sending the selection to the form, and then you can refer directly to the selection’s data.

Without knowing more about your setup, it’s hard to be more specific than that, but I hope this reply helps. If it doesn’t, maybe you can share more screenshots, and I’m sure someone will be able to help you figure this one out.

Best…
Mike

I think you might be right on the point of pointing to the parent’s group item. I understand that I need to stop asking it to look into the database and move away from ‘do a search for’, so when the user refreshes the page it will be a blank slate to enter new data and then save that (and therefore Bubble shouldn’t be searching for anything from previous entries and thereby changing anything on a blank form - such as disabling the editor because its picked up the most recent saved condition).

I implemented a parent’s group conditional here as suggested, and so far when I refresh the page the RTE I am testing it on isn’t disabled (unlike the other RTE which is as it hasn’t been changed yet). However, weirdly, the disable function isn’t being implemented at all even when it’s supposed when I select the dropdown option that should trigger it. As you can see below, the condition has some changes to the colour, and is supposed to disable the editor, but it’s not doing that one part of the condition.

image

All the other conditional elements look like they’re being implement except the most important, disabling of the RTE:

In that particular example, does the parent group have data associated with it or are you creating a new thing? Maybe try adding an “or” to your expression that says or the dropdown’s value is Yes - Lock Section.

This is a blank form, and so when the user hits save they will be creating a new thing.

It’s peculiar as its not working either. I have written out the full expression, with ‘is’ and ‘is Display’ - there is no ‘is value’. I have done this for both ‘yes’ and ‘NA’

It’s picking up all other elements of the expression but not the disabling one.

But you’re referring to the parent group each time. I may not understand what you are doing here, but I believe the parent group will only have data if the user is editing an existing thing. If the user is creating a new thing, then you can’t refer to the parent group in the condition. You likely need a new condition that refers directly to the dropdown’s value.

1 Like

Yes, I think the parent group thing won’t apply here because its not reading what’s already in the table (as it won’t exist for this entry).

I have gone with the below expression to apply the condition based on the current value of the dropdown. So far it looks like its behaving the way I want:

image

Looking at that I don’t know why I didn’t think of it after all this (I think it’s because most of my app actually uses the parent/do a search for expression successfully elsewhere, so had to just realise this expression also works on the current value in real time too).

Thanks!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.