forms

Save/design nested form to save/update data in mongodb via mongoose according to mongoose schema

蹲街弑〆低调 提交于 2020-01-23 12:58:28
问题 I have created the following mongoose schema for saving a quiz in mongodb - var answerSchema = new Schema({ answer: String, correct: Boolean }); var questionSchema = new Schema({ title: String, tag: String, chapterName: String, marks: Number, negativeMarks: Number, correctAnswerExplanation: String, hint: String, answers: [answerSchema] }); var quizSchema = new Schema({ courseId: Number, courseName: String, lectureId: Number, lectureName: String, popupTime: Number, teacherName: String,

Content Security Policy not allowing form submission

╄→尐↘猪︶ㄣ 提交于 2020-01-23 10:55:28
问题 Please I need assistance here. I have a form to submit to another url but when I try to submit it, it refuses to submit and checking my console. On Chrome, I see the following errors resources2.aspx?HCCID=75694719&culture=en-US&mlcv=3006&template=5:7 Refused to load the image 'https://s4.mylivechat.com/livechat2/images/sprite.png' because it violates the following Content Security Policy directive: "img-src 'self' data:". Refused to send form data to 'https://cipg.stanbicibtcbank.com

Wtforms: adding dynamic fields with multiple inheritance

寵の児 提交于 2020-01-23 07:07:47
问题 I know I can create dynamic fields like this: http://wtforms.simplecodes.com/docs/1.0.1/specific_problems.html#dynamic-form-composition But the above solution is unwieldy in my case, and requires a special API which I would like to avoid. I am wondering if there is a way to get this working with multiple inheritance? I tried the following and it won't work and I don't know why, I figured that WTForms should bind the forms properly given how the class structure is working: >>> class Base(Form)

Angular: Cannot find control with path: 'variable-> 0 -> id'

依然范特西╮ 提交于 2020-01-22 21:52:01
问题 I have been trying to use FormArray for a div that is dynamically added by the user, but I can't find the controls for the user inputs! I always have the error: Error: Cannot find control with path: 'textoAvisos -> 0 -> assTipo' Error: Cannot find control with path: 'textoAvisos -> 0 -> msgTipo' Error: Cannot find control with path: 'textoAvisos -> 0 -> dataTipo' The div contains 3 inputs that the user need to insert, which it seems that the control cannot find them. A new div is added after

Angular: Cannot find control with path: 'variable-> 0 -> id'

别说谁变了你拦得住时间么 提交于 2020-01-22 21:50:33
问题 I have been trying to use FormArray for a div that is dynamically added by the user, but I can't find the controls for the user inputs! I always have the error: Error: Cannot find control with path: 'textoAvisos -> 0 -> assTipo' Error: Cannot find control with path: 'textoAvisos -> 0 -> msgTipo' Error: Cannot find control with path: 'textoAvisos -> 0 -> dataTipo' The div contains 3 inputs that the user need to insert, which it seems that the control cannot find them. A new div is added after

Firefox jQuery form submission not working

倖福魔咒の 提交于 2020-01-22 20:41:50
问题 var makeField = function(name, value) { return $('<input />').attr({ type: 'hidden', name: name, value: value }); }; $('.login').on('click', function() { var form = $('<form />').attr('method', 'POST'); form.append(makeField('n0', 'data1')); form.append(makeField('n1', 'data2')); form.append(makeField('n2', 'data3')); $(document).append(form); form.submit(); }); The above code works fine in Safari, Chrome and Opera but firefox ignores form.submit(); . I tested the above code by adding console

Using named routes with parameters and form_tag

a 夏天 提交于 2020-01-22 20:30:09
问题 I'm trying to create a simple search form in Rails, but I think I'm missing something. I have a named route for search: map.search ":first_name/:last_name", :controller => "home", :action => "search" I'm trying to use that in my search form: <% form_tag(search_path, :method => 'get') do %> <%= text_field_tag(:first_name) %> <%= text_field_tag(:last_name) %> <%= submit_tag("Search") %> <% end %> But when I load up the search form I get an ActionController::RoutingError: search_url failed to

What are valid / invalid names for HTML form tags in jQuery?

夙愿已清 提交于 2020-01-22 19:53:10
问题 This flows from the error I ran into here jQuery $(’form’).serialize() returns only one element of a form serialized where having a form tag named "elements", like so: <form> <input name="elements"/> <input name="e2"/> </form> prevents you from accessing all the named elements of the form with jQuery's $('form').serialize() (i.e. you get "elements=" where you should get "elements=&e2="). I'd like to have more general information about what proper "name" elements of form tags. I.e. what are

Parsley.js - Validate optional input for only numbers

风格不统一 提交于 2020-01-22 19:07:28
问题 I have a form that has one optional input and 3 required input fields. For the optional input I have the below markup: <input type="number" placeholder="0" min="0" max="20000" step="100" data-parsley-validation-threshold="1" data-parsley-trigger="keyup"> This does not fire the validation if I have type in letters or any other characters. It does validate for min and max values. If I put required attribute it does seem to work but I don't want that. I also tried defining a pattern as below:

From HTML form to PDF

北城以北 提交于 2020-01-22 19:00:28
问题 Is there an easy way to have an HTML form on a webpage that, when the user submits, puts the data into a PDF file and sends it to the receiver? The webpage is running on .net. Thanks 回答1: Umbraco has a good PDF generator package called "XSL to PDF". It wil allow you to generate a PDF file from Umbraco just by defining a PDF template. Using this you should be able to achieve what you are looking for. 回答2: If you have C# use one of this libraries : http://csharp-source.net/open-source/pdf