From 595bec19edca1a6093dcd239c4c0e0f0e854b0c5 Mon Sep 17 00:00:00 2001 From: Soumyadeep Jana Date: Wed, 11 Oct 2017 16:05:25 +0530 Subject: [PATCH 1/2] Added client side form vaidation --- index.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.php b/index.php index 393b0df..01c1f47 100644 --- a/index.php +++ b/index.php @@ -26,6 +26,8 @@
+ +

$algo) { ?> @@ -37,6 +39,20 @@
+ + From fd096a8a9e677a7439302fbedaa877117c6723aa Mon Sep 17 00:00:00 2001 From: Soumyadeep Jana Date: Wed, 11 Oct 2017 16:11:06 +0530 Subject: [PATCH 2/2] Added trim method to avoid sending spaces as string --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 01c1f47..a2e5eac 100644 --- a/index.php +++ b/index.php @@ -46,7 +46,7 @@ { var input = document.querySelector("input[name='input']"); - if(!input.value.length) + if(!input.value.trim().length) { event.preventDefault(); document.querySelector("#error").textContent = "Please enter valid string";