logo
down
shadow

I use js to dynamically generate some forms but the data cannot be passed to the backend


I use js to dynamically generate some forms but the data cannot be passed to the backend

By : user3042335
Date : November 27 2020, 05:23 PM
wish helps you Problem in your code is with '' quotes as well as ,whenever you append new input it appear out of
tag , so whenever you submit your form that value doesn't passed to your backened page and will always return null. Instead do like below :
code :
var i = 1
$(document).ready(function() {
 //location to add new inputs
  var to_Add_at = $(".inputs");
  var add_button = $("input[name='add']");
  //on click of button
  $(add_button).click(function(e) {
    e.preventDefault();
    $(to_Add_at).append('<input type=text name='+i+' value='+i++ +'>'); //add input box

  });

});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<form action="/webTest/TestWeb" method="post">
  <input type="button"  value="add" name="add" />
  <div class="inputs"></div>
  <input type="submit" value="submit" />
</form>


Share : facebook icon twitter icon
symfony2 forms dynamically Generate Forms Based on user Data

symfony2 forms dynamically Generate Forms Based on user Data


By : user3241321
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Add this line in your ProjectuserType class : use Doctrine\ORM\EntityRepository
Hope it's helpful. Best regards.
Dynamically generate django forms

Dynamically generate django forms


By : Akanksha M
Date : March 29 2020, 07:55 AM
With these it helps I'm trying to dynamically generate python classes. Here, a django form. , You can add fields in the form's __init__ method as follows:
code :
class BankForm(forms.Form):
    name = forms.CharField()

    def __init__(self, *args, **kwargs):
        super(BankForm, self).__init__(*args, **kwargs)
        for i in range(10):
            self.fields['contact_' + str(i)] = forms.CharField()
AngularJS w/ Flask backend, representing the data passed from backend

AngularJS w/ Flask backend, representing the data passed from backend


By : zhang
Date : March 29 2020, 07:55 AM
To fix the issue you can do for anyone who may need it in the future! :) I added a for loop that iterates over the response data and stores each element into an array then returned the array.
code :
     data.getData = function(){
         var i;
         var myObj = [];
            $http({
                method: 'GET',
                url: '/h'
            }).then(function success(response){
                $log.info(" hello the get", response.data);
                for (i = 0; i < response.data.length; i++){
                    myObj[i] = (response.data[i]);
                }
                if(response.data.length === 0){
                    $log.info("empty set");
                }else{
                    //data.item = response.data;
                    $log.info("SUCCESS!!" + myObj);
                }            
            }, function error(response){
                $log.info(" damn"+response);
            });
            return myObj;
        };

.factory('posts', function(data, $log){
    "use strict";
    var posts={}; 

    posts.item = data.getData();

   posts.addPost = function(title, body){     
        data.postData(posts.item.push({title: title, body: body}));
   };
        $log.info("in the posts" + posts.item);
    return posts;
});

.controller('topicCtrl', function(posts){
    "use strict";
        var p = this;

    p.posts = posts.item;



})
Passed data with URLSearchParams is something other in PHP backend

Passed data with URLSearchParams is something other in PHP backend


By : Kayla Glenn
Date : March 29 2020, 07:55 AM
To fix the issue you can do Like you say it returning object HTMLInputElement, and that is not good.
return axios.post('/api/auth/checkUnique.php', params, axiosConfig)
Express backend dropping data when passed from Angular 5 App

Express backend dropping data when passed from Angular 5 App


By : Hazu Keil
Date : March 29 2020, 07:55 AM
around this issue I found the solution. I was not implementing a header with my post data. I added these changes to my service and the issue was resolved:
code :
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';

@Injectable()
export class ClientService {
    httpHeader = {
        headers: new HttpHeaders({
            'Content-Type': 'application/json',
        })
    };

    constructor(private http: HttpClient) { }

    sendEmail(clientData) {
        console.log(clientData);
        this.http.post('/send-email', clientData, this.httpHeader);
    }
}
Related Posts Related Posts :
  • redux how to use state
  • All data in the db is lost when closing a express based node js server
  • How to convert javascript code for Angular
  • XPath select on child nodes
  • Idle event on mouse move - how to stop script permanently on mouse move
  • Why do I get logic is not defined in this code
  • When I enter a number in the input, the first function starts
  • ES6 imports and node_modules hell
  • How to get css selector of clicked-on element?
  • How to auto input MySQL data (input column 1 data to auto input column 2 data with same column) in php?
  • Appending to Datalist Via Javascript
  • Customizing Material-UI Components with Styled-Components
  • Populate elements with class name using Javascript
  • How to execute promises in batches (first resolving 10, then next 10 and so on)
  • Maximo JS automation script: "importPackage" is not defined
  • How to surround selected text inside textarea with <em> on key combination CTRL+i?
  • Your configured registry does not support audit requests ~ On npm audit
  • What's the Angular equivalent of Vue <slot/>?
  • Iconify icon not updating when "data-icon" set with setAttribute()
  • Javascript newbie stuck with XMLHttpRequest return data
  • How to add obj to to state in my example Redux React
  • Loading "grunt-karma.js" tasks...ERROR >> SyntaxError: Unexpected identifier
  • Why do I get log is not defined
  • get the multiple index of the same string
  • How can I iterate over an Array object by using For IN or FOR OF
  • Launch local executable from web browser
  • How to prepare array of json objects to d3 hierarchical tree structure
  • VueJS - event emitted - show HTML before other calculations
  • Export SASS/SCSS variables to Javascript without exporting them to CSS
  • How to attach an event handler only once continuously
  • How to make button open a link in new tab in JavaScript?
  • Find range from the javascript object
  • How can I use my jQuery code as JavaScript?
  • How to show 5 images in a 2 row slider with bxslider
  • How to convert stream into variables in typescript
  • Three.js custom shader error on Chrome GL_INVALID_OPERATION: Active draw buffers with missing fragment shader outputs
  • My JavaScript doesn't work. How can I solve this problem?
  • Why is this async function is running synchronously?
  • Get updated variable from within react hook before return
  • I want to show all image preview but whenever I upload a new one the old one is gone
  • Would I be able to give access to specific electron APIs safely?
  • Why several clicks fire for each instance of a Class?
  • cant grab value from div using attr()
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org