2018-06-30         Mandel

Laravel 5.4 - pjax response an error Unprocessable Entity

I used laravel pjax plugins from laravel/spatie packageWhen i clicked the Login and Register link (basic laravel auth), it works fined. Pjax is working, but when i tried to login it shows an error .(1/1) HttpExceptionin Application.php (line 926)at Application->abort(422, '', array())in helpers.php (line 30)at abort(422)in FilterIfPjax.php (line 87)at FilterIfPjax->fetchContainer(object(Crawler), '#body')in FilterIfPjax.php (line 54)at FilterIfPjax->filterResponse(object(Response), '#body')in FilterIfPjax.php (line 35)at FilterIfPjax->handle(object(Request), obj...

 javascript                     1 answers                     23 view
 2018-06-30         John

Javascript Unintentionally Changing Multiple Objects' Array Attribute

I am running into a weird problem where I am trying to change the value of an attribute in a specific object it's changing that attribute value in all objects.Below is my code the creates these objects "nodes"function processNode(nodeID, name, fields){ this.id = nodeID; this.fields = fields; this.name = name;}var nodeFuncs = {table: function(nodeID){ function tableNode() {} tableNode.prototype = Object.create(new terminalNode(nodeID, 'table')); return new tableNode(nodeID, 'table'); } , source: function(nodeID){ function sou...

 javascript                     1 answers                     54 view
 2018-06-30         Rachel

Ukkonen's suffix tree algorithm in plain English

I feel a bit thick at this point. I've spent days trying to fully wrap my head around suffix tree construction, but because I don't have a mathematical background, many of the explanations elude me as they start to make excessive use of mathematical symbology. The closest to a good explanation that I've found is Fast String Searching With Suffix Trees, but he glosses over various points and some aspects of the algorithm remain unclear.A step-by-step explanation of this algorithm here on Stack Overflow would be invaluable for many others besides me, I'm sure.For referen...

 javascript                     6 answers                     0 view
 2018-06-30         Rock

Use Javascript to compare time ranges in PDF form

I have a PDF form with 6 different time periods for each day of the month and I need to make sure those time periods do not overlap when the user completes them. Not all time periods may be completed, but the ones that do must be unique. I have taken inspiration from this previous post Use JavaScript to compare time ranges specifically the contribution by @RobG. However, my lack of scripting knowledge is hampering my ability to mold that code for my specific application. In addition to have the time periods verified, I also have to repeat this for every day on the form ...

 javascript                     1 answers                     8 view
 2018-06-30         Darcy

What does "/^\s*$/" mean in this javascript?

I have this javascript that works well in my PDF form to set a field as required if another field contains data. However, I want to have it ignore a value of "0.00" for the test. But I do not know what /^\s*$/ means let alone how to alter the script for my condition. var rgEmptyTest = /^\s*$/;// t is the value to be tested and f is the field to set accordinglyfunction testMyField (t, f) {if (rgEmptyTest.test(t)) {this.getField(f).required = false; } else {this.getField(f).required = true; }}Thank you! In your piece of code there is a function that uses...

 javascript                     3 answers                     9 view
 2018-06-30         Viola

sum field values if they meet conditions

I am attempting to sum a number of field values but only if a condition associated with those filed values is met. For example:I have a PDF form with several number value fields. Each of those number fields is accompanied by a choice in status. I simply want to add all of the number fields of the same status. Here is the code I tried and thought was working but it seems that if a status is changed on a Field previously added, it fails to work. For example, if I add Field1, Field2 and Field4 because they are the same status but I go back and change Field2's status to someth...

 javascript                     2 answers                     10 view
 2018-06-30         Merry

sum field values based on condition in another field in javascript

I am attempting to sum a number of field values but only if a condition associated with those filed values is met. For example:I have a form with several number value fields. Each of those number fields is accompanied by a choice in status. I simply want to add all of the number fields of the same status, or possibly some with a couple different status. Here is the code I tried, that does not work:// field namesvar cTotal1 = "Day1Pd1Total";var cTotal2 = "Day1Pd2Total";var cTotal3 = "Day1Pd3Total";var cTotal4 = "Day1Pd4Total";var cTotal5 = "Day1Pd5Total";var cTotal6 = "D...

 javascript                     1 answers                     11 view
 2018-06-30         Jeff

javascript time formatting issue when hour is "12"

I have a PDF form whereas it needs to be able to either be filled out either electronically, or with a good old fashioned pen. As such it includes time calculations with a "Time In" and a "Time Out". For simplification, the form includes the options to select "am" or "pm" accordingly. See form entry sampleSo I think I have come up with a cleaver way that if used electronically, I can allow a user to input a time in "h:MM" format and to concat the "am" or "pm" selection putting the result into a hidden field with the "h:MM tt" format and performing my time calculation acc...

 javascript                     1 answers                     12 view
 2018-06-30         Warner

Unexpected end of file in PHP Javascript search function

I am having some trouble with a search function I have written PHP and Javascript.I have an input box which javascript script monitors for a value.When the javascript detects a value it queries search.php (mysql query) for rows containing the value and returns those rows in a list.This works great until the input value is the letter "d" which returns: Parse error: syntax error, unexpected end of fileCan anyone help?Thanks in advance. Can we see the code?Do you escape SQL? [XXX]

 javascript                     1 answers                     41 view
 2018-06-30         Lesley

Executing Linux commands from webpage

I have set up a very basic website on apache2 server (running on Ubuntu 18.04). The website has just one page. I used some JavaScript to add dynamic content to it, and the website contains HTML form, which sends data to MySql server -- I connected to the database with PHP. Based on user input, I need to execute a certain Linux terminal command (say: ls -l). For example, if user inputs first and last names and clicks on Submit button, the ls -l command will automatically execute without user doing anything in terminal. Is this possible?This is the HTML form I have:<form m...

 javascript                     1 answers                     43 view
 2018-06-30         Hardy

Shorten number labels in Charts.js

I'm making a simple line chart for a client using Chart.js, but the values shown are all above millions, making the labels take up a lot of space in the chart, as below:I would like to shorten the labels to show an M instead of six 0s, for instance. I've looked into the documentation and and have not found anything of such. You could override the ticks.callback method as documented here: https://www.chartjs.org/docs/latest/axes/labelling.html#creating-custom-tick-formatsFor example, to abbreviate the y-axis zeros to simply 'M':var chart = new Chart(ctx, { type: 'line'...

 javascript                     2 answers                     67 view
 2018-06-30         Tony

Multiple lines in Google Charts with different number of datasets

In Google Charts I want to display 3 different lines. But they do not have the same number of data points. The following Image was made with Excel Chart, so that you can understand my problem better.Line grey has only two data points, the orange line goes until 5 and the blue one has full data set.So now to my real project:in Google Chart I tried the same, so my dataArray looks like that (with 4 lines):["20180629", 24.5, 28, 27.52, 24.6],["20180630", 23, 28, 23.57, 24.4],["20180701", 22.6, 26, 23, 23.5],["20180702", 23, 25, 22.44, 23.5],["20180703", 25.1, 28, 24.43, 26.3],[...

 javascript                     1 answers                     66 view
 2018-06-30         Beacher

Javascript window.onload function not loading for multiple charts with Chart.js

I'm using Chart.js to display some charts.When I use the onload function for the pie chart it loads correctly on the page, when I add a second variable to onload for bar-chart, nothing will display.My javascript code looks like this var config = { type: 'pie', data: { datasets: [ { data : [10, 30, 40, 50], backgroundColor: [ "#F7464A", "#46BFBD", "#FDB45C", "#949FB1", "#65b13b", ], }], labels: ["4G", "5G", "Mano"], }, options...

 javascript                     1 answers                     67 view
 2018-06-30         Wanda

Check if object is array?

I'm trying to write a function that either accepts a list of strings, or a single string. If it's a string, then I want to convert it to an array with just the one item. Then I can loop over it without fear of an error. So how do I check if the variable is an array?I've rounded up the various solutions below and created a jsperf test. In modern browsers you can doArray.isArray(obj)(Supported by Chrome 5, Firefox 4.0, IE 9, Opera 10.5 and Safari 5)For backward compatibility you can add the following# only implement if no native implementation is availableif (typeof Array....

 javascript                     30 answers                     17 view
 2018-06-30         Elizabeth

React JSX: selecting "selected" on selected <select> option

In a React component for a <select> menu, I need to set the selected attribute on the option that reflects the application state.In render(), the optionState is passed from the state owner to the SortMenu component. The option values are passed in as props from JSON.render: function() { var options = [], optionState = this.props.optionState; this.props.options.forEach(function(option) { var selected = (optionState === option.value) ? ' selected' : ''; options.push( <option value={option.value}{selected}>{option.label}</option> ); });/...

 javascript                     10 answers                     18 view
 2018-06-30         Wright

Loop inside React JSX

I'm trying to do something like the following in React JSX (where ObjectRow is a separate component):<tbody> for (var i=0; i < numrows; i++) { <ObjectRow/> } </tbody>I realize and understand why this isn't valid JSX, since JSX maps to function calls. However, coming from template land and being new to JSX, I am unsure how I would achieve the above (adding a component multiple times). Think of it like you're just calling JavaScript functions. You can't put a for loop inside a function call:return tbody( for (var i = 0; i < numrows; ...

 javascript                     30 answers                     19 view

Page 8971 of 8971  |  Show More Pages:  Top Prev Next Last