#StackBounty: #javascript #node.js #async.js #formidable Error handling with Node.js, Async and Formidable

Bounty: 200

In the following snippet I would like to validate the fields in the first async method.

If they are not valid I would like to return an error to the user immediately.

How do I do that?

var form = new formidable.IncomingForm();

async1.series([
    function (callback) {
        form.parse(req);

        form.on('field', function (name, val) {
            // Get the fields
        });

        form.on('fileBegin', function (name, file) {
            if (file.name !== "") {
                file.path = __dirname + '/upload/' + file.name;
            }
        });
        callback();
    },
    function (callback) {
        form.on('file', function (name, file) {
            try {
                // Do something with the file using the fields retrieved from first async method
            }
            catch (err) {
                logger.info(err);
            }
        });


        callback();
    }
], function (err) {
    //the upload failed, there is nothing we can do, send a 500

    if (err === "uploadFailed") {
        return res.send(500);
    }

    if (err) {
        throw err;
    }
    return res.status(200);

});


Get this bounty!!!

#StackBounty: #magento2 #javascript #mailchimp Magento2 – Add mailchimp popup

Bounty: 50

we have magento 2.1.7ce and would like to add he mailchimp popup to our homepage.

We currently don’t have access to the ftp/SSH so we have to do this with the cms pages.

When i add this code to a CMS page:









And access the firebug console is see it’s trying to load files from the static files:

"NetworkError: 404 Not Found - https://server.com/static/frontend/Theme/customtheme/nl_NL/mojo/signup-forms/Loader.js

"NetworkError: 404 Not Found - https://server.com/static/frontend/Theme/customtheme/nl_NL/dojo.js"

How can i fix this? Or is it not allowed to use JavaScript in cms pages?


Get this bounty!!!

#StackBounty: #javascript #c# #jquery #asp.net #gridview How to bind GridView on TextBox's KeyPressed event

Bounty: 50

I have a TextBox with KeyPressed event and I want to bind GridView on that event.

<asp:TextBox ID="txtSearch" runat="server" OnKeyPressed="txtSearch_KeyPressed()">
</asp:TextBox>


  function txtSearch_KeyPressed()
  {
      // gvBanquet is an ID of GridView and SearchBanquet method returns a DataTable
      gvBanquet.DataSource = DLBqt.SearchBanquet(txtSearch.Text.Trim());
      gvBanquet.DataBind();
  }

Note that GridView binding code is from .CS file:

gvBanquet.DataSource = DLBqt.SearchBanquet(txtSearch.Text.Trim());
gvBanquet.DataBind();

I don’t know how it will work? It should bind on key pressing of TextBox.


Edit: I have find a solution server site OnTextChanged event of TextBox which bind the GridView after pressing Enter instead of pressing a key.

<asp:TextBox ID="txtSearch" runat="server" OnTextChanged="txtSearch_TextChanged" 
    AutoPostBack="True" ></asp:TextBox>

protected void txtSearch_TextChanged(object sender, EventArgs e)
{
    gvBanquet.DataSource = DLBqt.SearchBanquet(txtSearch.Text.Trim());
    gvBanquet.DataBind();
}

I don’t want it with OnTextChanged event but I think it would work on keypressed event using JavaScript or jQuery so I don’t know how to do?


Update: I have tried below jQuery code to key pressed in textbox but its also not working.

$(document).ready(function () {

    $('#txtSearch').on("keyup", function () {
        // could bind bind GridView here??
        e.preventDefault();
    })
})

Note: GridView and TextBox both are inside UpdatePanel.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>

  
</div> <!-- /.col-lg-12 -->
'> ' > '> '> '> '> '> '> '> '> Events ' />
<!-- /.col-lg-12 --> </ContentTemplate> </asp:UpdatePanel>


Get this bounty!!!

#StackBounty: #javascript #jquery #html #typescript #kendo-ui lint errors making the code change but not sure how to proceed

Bounty: 50

  • I am new to tslint and typescript.
  • I am trying to fix this error.
    Property ‘waterService’ cannot be declared in the constructor

  • happening at this line
    constructor(public sportsService: SPORTSService) {}

  • can you tell me how to fix it.

  • i did some research but not able to find solutions.
  • providing code below.
  • even looked at this link and tried but not able to proceed

https://github.com/Microsoft/tslint-microsoft-contrib

Property ‘waterService’ cannot be declared in the constructor

/** Trees for contract and title. */
import {
  Component,
  Inject,
  OnInit,
  EventEmitter,
  ViewChild,
  Input,
  Output
}
from '@angular/core';
import {
  SPORTSService
}
from '../../services/sports.service';
import {
  KendoGridComponent
}
from '../grid/grid.component';
import {
  KendoDialog
}
from '../shared/kendoDialog/kendodialog';
import {
  ProgressCircle
}
from '../shared/progress/progress-circle';

declare let $: any;



@Component({
  selector: 'player',
  template: `
` }) export class player implements OnInit { private henInfoPopUpWindow; private airDate; private airTime; private showTitle; @Input() kendoCommandObj: any; constructor(public sportsService: SPORTSService) {} private kendocommand = { edit: { createAt: "bottom" }, group: false, reorder: true, disableFreeze: true, resize: true, sort: true, autoBind: true, filter: false, pager: { messages: { //display: "Showing {0} to {1} of {2} entries" } }, model: {}, columns: [], pagesize: 50, getComponentUrl: "swimming", searchFields: [], mandatoryFields: [], saveStatus: false }; @Output() applyAPTInfo: EventEmitter < any > = new EventEmitter < any > (); @Output('mouseCount') getTreeEvent = new EventEmitter<number>(); ngOnInit() { this.mouseType = 'hen'; let that = this; let attributes=this.sportsService.getSeesionStorageValue();


Get this bounty!!!

#StackBounty: #hyperref #pdf #links #javascript submitForm error with javascript on a PDF

Bounty: 50

MWE

documentclass{article}
usepackage[pdfpagemode=None,pdfstartview=FitH,pdfview=FitH,colorlinks=true]{hyperref}
usepackage[pdftex]{insdljs}
usepackage[pdftex]{eforms}

begin{document}

pushButton[CA{POST}A{JS{
url = "http://debis.deu.edu.tr/DEUWeb//hdp.php";
donem = "243";
fakulte2 = "126";
hafta = "18/09/2017_24/09/2017";
hoca = "7_8";
SUBMIT = "TAMAM";
app.alert(donem + " "+ fakulte2 +" "+  hafta +" "+ hoca +" "+  SUBMIT);
this.submitForm(url, false);
}}]{myButton}{36bp}{12bp}
end{document}

This code gives an error as follows:

enter image description here.

Is it a mistake to ask here this question? Where do I make mistakes?


Get this bounty!!!

#StackBounty: #javascript #jquery #datatables Need to access mData nested value in jquery datatable

Bounty: 50

Below is my api response,

{ "aaData":{"req":[{"requests":"132"}]}}

Need to show requests value in jquery datatable below is my code,

"aoColumnDefs": [
        {
            "aTargets": [0],
            "mData":"req[0].requests",
        },

but above code not working,but if change api reponse to below,

{ "aaData":{"req":"132"}}
"aoColumnDefs": [
            {
                "aTargets": [0],
                "mData":"req",
            },

above code working…..How can I access the requests value from this kind of response { "aaData":{"req":[{"requests":"132"}]}} , Anyhelp appreciated..


Get this bounty!!!

#StackBounty: #javascript #html5 #speech-recognition Is there a way to use the Javascript SpeechRecognition API with an audio file?

Bounty: 50

I want to use the SpeechRecognition api with an audio file (mp3, wave, etc.)
Is that possible?


Get this bounty!!!

#StackBounty: #javascript #ios #iscroll iScroll on ios doesn't work after upgrading to iScroll5

Bounty: 100

I have a cordova app for ipad that uses iScroll to scroll among pages.
All worked fine until i upgraded to iScroll5.
I changed my code, to use new constructor and parameters, but it still doesn’t work. It simply doesn’t scroll.
I don’t know if i’m missing something obvious, but I cannot find an exaustive documentation about the upgrade.

This is an example of how I used it before (iScroll4):

var options = {hScroll:false, hScrollbar:false, snap:true, onScrollEnd: updatePages(), momentum: false};
var scroller = new iScroll("wrapper", options);  

And this is how I use it now (iScroll5):

var options = {scrollX: false, snap: true, momentum: false};  
var scroller = new IScroll("#wrapper", options);  
scroller.on("scrollEnd", updatePages());

Any help is greatly appreciated! Thanks!


Get this bounty!!!

#StackBounty: #javascript #jquery #html #ruby-on-rails #turbolinks Show page once FULLY loaded with Turbolinks

Bounty: 100

I am using Turbolinks and I have a loading animation that happens between pages. I am currently using page:load to complete the animation however, it seems as if page:load is acting like document ready rather than window.on load.

The desired effect is I have an overlay that is displayed over the content while the page is loading with a loading animation on top of it. Once the page is fully loaded (with images, objects, etc) it will then fade out the overlay to show the content.

What is happening is the content is being shown before the page is fully loaded. Here is the javascript I am using.

    (function () {

      function showPreloader() {
        Turbolinks.enableProgressBar();
        $('#status').fadeIn('slow');
        $('#preloader').delay(300).fadeIn('slow'); 
      }

      function hidePreloader() {
        $('#status').fadeOut();
        $('#preloader').delay(300).fadeOut('slow');
      }

      $(document).on('page:fetch', showPreloader);
      $(document).on('page:load', hidePreloader);
      $(window).on('load', hidePreloader);
    })()


Get this bounty!!!

#StackBounty: #javascript #html Cannot place cursor on whitespace-filled TEXTAREA from mobile

Bounty: 50

I have a TEXTAREA control (ID=”taCode”), maxlength=400, that is pre-filled with 400 whitespaces.

I use Javascript to force insert-mode (replace) when entering text into textarea:

var input = document.getElementById("taCode");
input.addEventListener('keypress', function(){
    var s = this.selectionStart;
    var e = this.selectionEnd;
    this.value = this.value.substr(0, s) + this.value.substr(e + 1);

    if (this.value.length < 399)
    {
        this.value += new Array(399-this.value.length).join(' ');
    }

    this.selectionEnd = this.selectionStart = s;
}, false);

HTML:

<TEXTAREA ID="taCode" COLS="80" ROWS="5" MAXLENGTH="400" style="overflow:hidden">                                                                                                                                                                                                                                                                                                                                                                                                                </TEXTAREA>

Everything works fine using a desktop and mouse, but trying to place the cursor inside the TEXTAREA using a mobile (Iphone) fails (EDIT: Always placed at last pos on first row) and nothing can be typed into the field. Any idea of how to get it to work for mobiles?

Test: http://artificial.se/ta.html


Get this bounty!!!