Reputation: 5
I tried to send the value of an input field to a cypher query. For example when the user introduces a technology and clicks the submit button must appear a list of the assigned programmers. This code is at submit button:
match (technology:Technology {name: ${technology.name}})<-[skill:SKILL]-(Programmer) return Programmer,skill,technology
In the input field i set the value with ${technology.name}.This is the generated code:
<div>
<form action="/search" method="POST" data-structr-attr="technology">
<input value="" data-structr-name="technology">
<input type="submit" value="submit">
</form>
</div>
The problem is that nothing happens. Does anyone know where I did wrong? Thank you.
Upvotes: 0
Views: 262
Reputation: 319
In order to POST the technology value using an HTTP form, you need to set the name
attribute of the input field to "technology". The mistake in the above code is that you set data-structr-attr
, but not name
, which is on the "HTML Attributes" tab:
<div>
<form action="/search" method="POST">
<input type="text" name="technology">
<input type="submit" value="submit">
</form>
</div>
Also, you wrote that the Cypher statement is on the submit button. In order for the search to work, you will need to configure the search page (the page that the form refers to in the action
attribute) so that it uses the value from the form. The Cypher statement must be somewhere in the search page and not in the submit button.
Upvotes: 3