0

I'm using WTForms to create a form with fields that have "sub fields" like so -

class TableName(FlaskForm):
   schema = StringField('Schema', validators=[DataRequired()], id = 'schema_name')
   table = StringField('Table', validators=[DataRequired()], id = 'table_name')

class QaForm(FlaskForm):
   test_table_in = FormField(TableName, id = 'test_table')
   prod_table_in = FormField(TableName, id = 'prod_table') 

Front end looks like this - fields consisting of "sub-fields"

How do I reference this form element in JQuery? I've tried the below but it gives me an "undefined" error when I try to print the variables -

var tables = {
                test_table: $('#test_table-schema_name').val() + "." + $('#test_table-table_name').val(),
                prod_table: $('#prod_table-schema_name').val() + "." + $('#prod_table-table_name').val()
            };

1 Answer 1

0

Did you figure this out yet? Have you tried using your browser inspect element tool to view the variable name of the field you're seeking?

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, it turns out this the issue was unrelated to how I was calling the form elements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.