Insert text from ID HTML

Hello Guys

I'm reaching out to see if you can help me solve this.

I have to make a dropdown with the following

- Serial: <span class="asset" id="asset1">INSERT ASSET1 info from API</span> - Modelo: Macbook Pro
- Serial: <span class="asset" id="asset2">INSERT ASSET2 info from API</span> - Modelo: Xiaomi

the "id" info we got it from an IP already integraded and it should go on the field,

I'm not able to make it work correctly since I don't know how to insert the text we get from the id identifier.

Any ideas?

Hi @Francisco_Alejandro, welcome back to the forum! :slight_smile:

You may use the {site} command twice to read the text and HTML of the desired elements, then extract the id attribute with extractregex and transform the results to a formmenu as follows:

{ids={site: html; selector=.asset; multiple=yes}}
{names={site: text; selector=.asset; multiple=yes}}
{options=[name: extractregex(ids[index], "id=\"([^\"]+)\"") for (name, index) in names]}
{formmenu: values={=keys(options)}; itemformatter=(x, y) -> x; formatter=(name) -> options[name]}

I hope that helps you.