Skip to content

Input type enforcement - #113

Merged
MImran2002 merged 7 commits into
developmentfrom
inputTypeEnforcement
Oct 14, 2026
Merged

MImran2002 merged 7 commits into
developmentfrom
inputTypeEnforcement

Conversation

@bakobagassas

Copy link
Copy Markdown
Contributor

fixes issue #104

When a user goes to Administration → Course Management and adds a new course, the course number field currently allows alphabetic characters to be entered.

Changes

  • Added the JavaScript file path in the course management html file
  • Added an event listener that displays a validity tag when an input is typed && the input is not a number

Testing

  • Checkout inputTypeEnforcement branch
  • run python app.py
  • go to Administration → Course Management and add a new course
  • The course number field should now display a validity tag when the input has any non-number

Comment thread app/static/js/local/courseManagement.js Outdated
@Gavin-Miller23
Gavin-Miller23 requested review from Gavin-Miller23 and a lite review from Copilot and removed request for Copilot September 24, 2026 15:20
@Gavin-Miller23

Copy link
Copy Markdown
Contributor

I can submit even if i type one period after the number. Multiple periods won't work and no other symbols and spaces work, but one period gets through if there is a number beforehand.

@@ -0,0 +1,6 @@
$("#number").on("input", function(){
if ($(this).val() && isNaN($(this).val())) {
this.setCustomValidity("Please enter numbers only.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could still add a period (.) after the course number

Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bakobagassas has this been resolved? if so I will do a final check and merge this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the period now triggers the validity tag too and the spaces are just automatically stripped

@baobao1355 baobao1355 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go!

@MImran2002 MImran2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@MImran2002
MImran2002 merged commit 35d5ef1 into development Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants