Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic content for Flask dropdown menu in HTML form #12

Open
bhpayne opened this issue Jan 2, 2025 · 0 comments
Open

dynamic content for Flask dropdown menu in HTML form #12

bhpayne opened this issue Jan 2, 2025 · 0 comments
Assignees

Comments

@bhpayne
Copy link
Member

bhpayne commented Jan 2, 2025

In https://github.com/allofphysicsgraph/ui_v8_website_flask_neo4j/blob/gh-pages/webserver/pdg_app.py there's a class

class SpecifyNewExpressionForm(FlaskForm):
    expression_latex_lhs = StringField(label="LaTeX expression LHS")
    expression_latex_rhs = StringField(label="LaTeX expression RHS")

which gets instantiated in to_add_expression and then used in
https://github.com/allofphysicsgraph/ui_v8_website_flask_neo4j/blob/gh-pages/webserver/templates/property-graph/expression_create.html in

{{ form.expression_latex_lhs(id="input_latex_lhs") }} = 
{{ form.expression_latex_rhs(id="input_latex_rhs") }}

In the HTML I'd like to collect the relation, e.g.,

{{ form.expression_latex_lhs(id="input_latex_lhs") }} 
{{ form.expression_latex_lhs(id="input_latex_relation") }} 
{{ form.expression_latex_rhs(id="input_latex_rhs") }}

which means in the class I'd like to add

expression_relation = SelectField("relation", choices=self.list_of_relation_dropdown_tuples)

However, I wasn't able to figure out how to dynamically specify the list of tuples when instantiating the class.

@bhpayne bhpayne self-assigned this Jan 2, 2025
@bhpayne bhpayne changed the title dynamic content for dropdown menu in form dynamic content for dropdown menu in HTML form Jan 2, 2025
@bhpayne bhpayne changed the title dynamic content for dropdown menu in HTML form dynamic content for Flask dropdown menu in HTML form Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant