Home  >  Q&A  >  body text

python - flask-wtf中两个SelectField可否实现在后台实现联动呢?如果不能在前台又应该怎么写js代码呢?

class form(Form):
    select1 = SelectField(u'型号', choices = [(2, '2'), (5, '5')]) 
    select2 = SelectField(u'规格', choices = [(2, '2'), (5, '5')]) 

怎样写代码再能是前端的select实现联动呢?(select1选2,select2也自动选2),求大神指点。。

高洛峰高洛峰2742 days ago931

reply all(1)I'll reply

  • 黄舟

    黄舟2017-04-17 15:57:57

    1. You need to figure out what WTForms does.
    Please refer to http://segmentfault.com/a/1190000002531677

    2. For products in B/S mode, the server side only provides the reception, processing and return of data. Browser side, from the client itself.
    So according to your description, the effect is to get the result on the B side, and the trigger of this result also comes from the B side itself. Then we can only let JavaScript handle this matter. Since this analysis is implemented, the monitoring, processing, and results of the event are also implemented.

    reply
    0
  • Cancelreply