question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug type number when using firefox

See original GitHub issue

Issue type

I’m submitting a (check one): [x] Bug report [ ] Feature request [ ] Regression (something that used to work, but stopped working in a newer version) [ ] Support request [ ] Documentation issue or request

Prerequisites

Before posting, make sure you do the following (check all): [x] Confirm you are using the latest versions of all necessary packages (or if not, explain why not) [x] Search GitHub for a similar issue or PR [ ] If submitting a Support request, also search Stack Overflow for similar issues Note: Please cross-post GitHub support requests to Stack Overflow, and include a link in your GitHub issue to your Stack Overflow question. We do currently respond to support requests on GitHub, but we eventually expect to stop, and will then refer all support questions exclusively to Stack Overflow.

Current behavior

The page just freezes when I click on the input for number in firefox. It’s working in chrome

Expected behavior

IMPORTANT: How can we reproduce your problem?

selectedFramework = 'material-design';

schema = {
    'type': 'object',
    'title': 'test',
    'required': [ 'numbers'],
    'properties': {
'numbers': {
        'title': 'numbers',
        'type': 'number',
        'validationMessages': {
          'pattern': 'Invalid number'
        }
}

 <json-schema-form
  loadExternalAssets="true"
  [schema]="schema"
  [framework]="selectedFramework"
  (onSubmit)="submit($event)">
  </json-schema-form>

Environment

OS name & version: Ubuntu 16.04 Browser name & version: Firefox 58.02 Angular version: 5.1.1 Angular JSON Schema Form version(s): 0.7.0-alpha.1 Other relevant software or packages:

Any other relevant information

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
catullcommented, Mar 15, 2018

Well, dear friend.

There is a subtle error in your schema:

        'pattern': '^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_\+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?',

The error is in @:%_\+~#=] “\+”, it is illegal. Make that “\\+”.

My go-to place for quick schema checks is https://www.jsonschemavalidator.net/

By the way, your schema is in non-JSON format, TypeScript or plain JavaScript format.

In fact, the proper format, properly marked up, shows you an error here already, can you spot it ?

This would be your original schema, as genuine JSON, marked up with ```json (payload on a separate lines) + Linefeed + ```"

{
    "type": "object",
    "title": "test",
    "required": ["name", "Description", "bindable", "simpleUrl"],
    "properties": {
      "name": {
        "id": "Name",
        "title": "Name",
        "type": "string",
        "pattern": "^[a-zA-Z]+$",
        "description": "name of the service instance should contain only letters",
        "validationMessages": {
          "pattern": "Only letters"
        },
        "options": {
          "dependencies": [{
            "id": "Description",
            "value": "ok"
          }]
        }
      },
      "gnfg": {
        "title": "fgnfgn",
        "type": "integer",
        "validationMessages": {
          "pattern": "Only numbers"
        }
      },
      "Description": {
        "id": "Description",
        "title": "Description",
        "type": "string",
        "maxLength": 20,
        "validationMessages": {
          "pattern": "max 20 characters"
        }
      },
      "bindable": {
        "id": "bindable",
        "title": "bindable",
        "type": "boolean"
      },
      "simpleUrl": {
        "id": "simpleUrl",
        "title": "simpleUrl",
        "type": "string",
        "pattern": "^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_\+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?",
        "validationMessages": {
          "pattern": "URL invalide"
        }
      },
      "email": {
        "id": "Email",
        "title": "Email",
        "type": "string",
        "pattern": "^\\S+@\\S+$",
        "validationMessages": {
          "pattern": "Invalid Email."
        }
      },
      "directory": {
        "id": "directory",
        "title": "directory",
        "type": "string",
        "pattern": "^(.+)/([^/]+)$",
        "default": "/var/vcap/store/cassandra",
        "validationMessages": {
          "pattern": "Invalid directory."
        }
      },
      "title": {
        "type": "string",
        "enum": ["dr", "jr", "sir", "mrs", "mr", "NaN", "dj"]
      },
      "arr": {
        "type": "array",
        "items": {
          "type": "object",
          "required": [],
          "properties": {
            "site": {
              "type": "string"
            },
            "url": {
              "type": "boolean"
            }
          }
        }
      }
    }
  }

You should see this:

screen shot 2018-03-15 at 12 35 23

0reactions
hamzahamidicommented, Mar 15, 2018

You tried it with my schema & there is no bug?

Read more comments on GitHub >

github_iconTop Results From Across the Web

1398528 - HTML <input type=number> should not allow users ...
My personal opinion on the matter: The problem rather is that the current implementation even though right is just not practical. The majority...
Read more >
HTML5 input type number not working in firefox - Stack Overflow
I think this is the best practice in my previous projects experience. This solution worked on Firefox, Safari and other not support input[type=number]...
Read more >
input type number allow any character in Firefox #4941 - GitHub
Any character can be typed into the input field in Firefox due to the implementation choice within Firefox. Firefox allows the entry of...
Read more >
firefox input type="number" not working toFixed() - Laracasts
It's with Firefox handling the number input. I tried doing some workarounds like setting the step attribute to "0.01" and "any" with no...
Read more >
Firefox required bug • REPL • Svelte
//number = undefined;. 12. } 13. </script>. 14. ​. 15. <form on:submit|preventDefault={submit} bind:this={form}>. 16. <input type="text" bind:value={text} ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found