Hide a form after specific API action data value

Hi,

After sending a form and executing an API Action in a Server Action (Steps), I am trying to hide the form when a data value becomes READY.

So, in the Dynamic Attributes of the form, I set Hide when Analyse.data.analyse.data.status=‘READY’

However, it does not work and I see this error message in the browser console:

Error: Lexer Error: Unexpected token ‘=’ at column 32 in expression [Analyse.data.analyse.data.status=‘READY’]
at Object.dmx.lexer (parser.js:160)
at Object.dmx.parse (parser.js:387)
at n. (BaseComponent.js:316)
at Array.forEach ()
at n.$updateBindings (BaseComponent.js:314)
at n.$update (BaseComponent.js:301)
at BaseComponent.js:306
at Array.forEach ()
at n.$update (BaseComponent.js:305)
at appConnect.js:274

Can you help me, please?

If you are using = it’s wrong, it should be ==

1 Like

No errors now, but the form is still visible.

Probably you are using a wrong expression or value then?
What does your API returns exactly about the status?

This is the response I get back from the API Action:

{"analyse":{"status":200,"headers":{"0":"HTTP\/1.1 200 OK","Date":"Sun, 01 Mar 2020 20:02:56 GMT","Server":"Apache","X-Content-Type-Options":"nosniff","X-Xss-Protection":"1; mode=block","Strict-Transport-Security":"max-age=31536000","X-ClientMaxAssessments":"25","X-Max-Assessments":"25","X-Current-Assessments":"0","Cache-Control":"no-cache, no-store, max-age=0, must-revalidate","Pragma":"no-cache","Expires":"0","X-Frame-Options":"DENY","Content-Type":"application\/json;charset=UTF-8","Set-Cookie":"JSESSIONID=20430DCF344BF4965AA56FADFA1F18F6; Path=\/; Secure; HttpOnly"},"data":{"host":"www.website.com","port":443,"protocol":"http","isPublic":false,"status":"READY","startTime":1583091223040,"testTime":1583091254499,"engineVersion":"2.1.0","criteriaVersion":"2009q","endpoints":[{"ipAddress":"x.x.x.x","serverName":"www.website.com","statusMessage":"Ready","grade":"A+","gradeTrustIgnored":"A+","hasWarnings":false,"isExceptional":true,"progress":100,"duration":31407,"delegation":2}}}

However, initially can be different. In any case, it does not work even when the value is already “READY”.

What is the expression which you used in the dmx-show exactly?

In the Form:form1, under dynamic attributes:

Hide
When: Analyse.data.analyse.data.status==‘READY’

image

Where are you picking the expression from in the data picker? Isn’t it from the form -> data?

Yes, from the data picker of the form.

Hm, why do you have the server connect included on the page, when you only need it selected in the form?
If you are using a server connect form, you should not add the server connect separately on the page…

Also in the data picker you have not selected the data returned by the form.

1 Like

It works now!

I removed the Server Connect from the page, and used the data returned by the form.

Thank you.

1 Like