Skip to main content

Posts

Does Javascript have a way to parse numeric strings accounting for different global character sets?

Is there a way to validate/parse strings into integers when the characters used may use numeral character sets other than the standard Western 0-9? Background: My Javascript application prompts users for integer input (their age), but some users answer using non-Western numerals due to their keyboard settings. Currently, those don't pass validation, but I'd like to accept and parse all valid integer responses, regardless of what numeral character set is used. Desired behavior: "12" => 12 // English/Western "১৬" => 16 // Assamese "२४" => 24 // Hindi Is there a way to do this consistently without hardcoding all possible numeral sets explicitly? Via Active questions tagged javascript - Stack Overflow https://ift.tt/euaPzdn

ExtJs - grid.column.Column - how to take it out and use it somewhere else

I need to extract these column lists from Ext.grid.column.Column together with the checkboxes and the entire mechanism for the button above the table. I would not like to create the entire mechanism from scratch, but just use the available option. Is it possible? This: Via Active questions tagged javascript - Stack Overflow https://ift.tt/MV1o0qt

Fiori Controller.js Changes not Reflecting without Modifying Component-Preload.js

I have a Fiori app that I need to customize in VS Code. The change is to be made in the Detail.controller.js file. I noticed that the changes I made in the Detail.controller.js file did not reflect until I made those exact changes in the Component-preload.js file. Interestingly, I haven't encountered a similar situation with View files. Can someone shed light on why this behavior seems specific to Controller files? Does this imply that for code changes in Controller files, updating only the Component-preload.js file is necessary? TIA, Ruzna Via Active questions tagged javascript - Stack Overflow https://ift.tt/MV1o0qt

fetch graphql query from external server

i'm trying to fetch some leetcode stats using leetcode's graphql schema. when i enter the query in the browser, it gives me a response, but it's not responding to me when i use axios. here's the query i enter in the browser: https://leetcode.com/graphql?query=query { questionSubmissionList( offset: 0, limit: 20, questionSlug: "two-sum" ) { lastKey hasNext submissions { id title titleSlug status statusDisplay lang langName runtime timestamp url isPending memory } } } and here's what i have in my code: let url = `https://leetcode.com/graphql`; const fetchSubmissionList = async (questionSlug) => { let query = ` query questionSubmissionList( offset: 0, limit: 20, questionSlug: $questionSlug ) { lastKey hasNext submissi

415 (Unsupported Media Type) error in dot net core web API

I am using dot net core Web API. I have a controller HomeController.cs using Microsoft.AspNetCore.Mvc; using WebAPI.Models; namespace WebAPI.Controllers { [ApiController] [Route("[controller]")] public class HomeController : Controller { [HttpPost] public IActionResult Index(User user) { return Ok(user); } } } The model user is as follows namespace WebAPI.Models { public class User { public string username { get; set; } public string password { get; set; } } } When I run the following jquery code from the front end I get an error 415 (Unsupported Media Type) $.ajax({ type: "POST", url: "https://localhost:7137/Home", data: { username: "username" , password: "password"}, success: function(data){console.log(data)}, dataType: "application/json" }); I am not getting what mistake I am doing. Via Active questions

Form validation error message alert does not appear (JavaScript)

I have a form that, with JS, has an error message that is meant to appear when one or more of the fields in the form are left empty. However, when I click the submit button, nothing appears. HTML: <body> <script type=text/javascript src="script.js"></script> <h1>Organisation Score Calculator</h1> <!-- <h4>Input the name of the charity.</h4> <input type="text" id="nameOfOrganisation"> <h4>Which state/territory does this organisation service?</h4> <input type="text" id="state"> <h4>What is the ACNC listed size for this organisation?</h4> <input type="text" id="size"> <h4>What percentage of the organisation's total income is from government grants?</h4> <input type="text" id="governmentGrants"> <h4>How much net profit does the organisatio