(SOLVED) Show in repeater a text box conected to database only if contain certain text dynamicaly.

Community friends I would like a text box to be hidden or to be displayed from a logical test.

The logical test should see if the text of that box is equal to that of the assigned condition, the text is connected to a data collection.

the text box would be hidden by default and would be shown when you complete that logical test.

I am not a programmer but I am beginning to like the Corvid code very much, I appreciate your help.

Would it be possible for me to share a sample code?

THANKS!

Your question is too general.
Basically, let’s say you want to compare a user input the the box content, then you can do something like:

$w.onReady(() => {
$w("#dataset1").onReady(() => {
    $w("#input1").onChange(event => {
        $w("#input1").value === $w("#text1").text ? $w("#text1").show() :         $w("#text1").hide();
        })
    })
})

or something like that.

I’m going to check if it works and I tell you. THANK YOU VERY MUCH FOR YOUR SUPPORT!

I see that you use as a trigger the change of a text element, in my case the text was generated in a form previously and I need that when loading the page the text is displayed or not the text is connected to a database. Could you show me how to modify the code to get the result I want?

I don’t think I understand what you you mean. The desired flow is not clear enough.

sorry my english is a barrier i will try to explain better.

I have a repeater that shows some local companies, in the companies form they define if they have home delivery for example a fast food restaurant.

What I require is to show if they have home service in the repeater otherwise the text box is hidden.

the data is in the database of companies when loading the page should only show in the repeater who have home service.

That is my situation, I appreciate your patience and I apologize for my bad English.

So you have a repeater that’s connected to a dataset, and you want to hide the text element if there’s no relevant info. Right?
Let’s say that the the field key in your database is “deliveryInfo”:

$w.onReady(() => {
    $w("#repeater1").onItemReady(($item, itemData, index) => {
        itemData.deliveryInfo ? $item("#text1").show() :  $item("#text1").hide();
    })
})

How would you do the logical test?

if you have the text “xxxx” show

if not then hide?

I tested the code and it shows me in all businesses the 2 options some with “has home delivery” and others “has no home delivery” I should hide the text boxes where it appears that there is no home delivery.

please help!

This is my code… #domicilio is text box conected to database, must show the text box only if the text in same box is equal to “-Servicio a domicilio-'” else hide.

sorry for my bad english am not programer.






$w.onReady

if($w("#domicilio") === '-Servicio a domicilio-') {
$w("#domicilio").show();

} else{
// Collapse the wishlist.
$w("#domicilio").hide();
}

Could you share the code? I don’t really program the truth. I don’t understand the apis I try to modify the code to build these functionalities and in fact I am starting to start programming.

(I must study basic programming)

I appreciate your collaboration.

the J.D code show the text box in both texts. :frowning:

I managed to solve it this way, now if some boxes are hidden and others appear according to the logical test.

This is frustrating but at the same time it feels very good when it is gradually achieved and you learn from mistakes.

I appreciate everyone’s collaboration.

$w.onReady(function () {
$w("#dynamicDataset").onReady( () => {
$w("#repeater1").forEachItem( ($item, itemData, index) => {
if(itemData.domicilio === "-Servicio a domicilio-"){
$item("#domicilio");
}
else {
$item("#domicilio").text = " ";
}
} );
} );
} );

@deleteduser thank you very much! Although I solved it before seeing your code you really gave me the light to understand my mistake, I appreciate your valuable answers. They are gold for newbies like me.