Help regarding html forms | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help regarding html forms

I want the form action to be done only when given input is what i want.. for ex (see the below code) i want the form action to be done only if i give some specific characters and click submit..in this code if i give any character and click submit, the form action is executed but i don't want that..how can i set some prefixed password using html? https://code.sololearn.com/WrauOVPc3OxH/?ref=app

20th Apr 2018, 3:26 PM
Ravindra Desai
Ravindra Desai - avatar
9 Answers
+ 3
https://code.sololearn.com/WkRPLzRI3FIX/?ref=app I edited your code and added some JavaScript. If you type any text othet than "Words", it will not direct you to other page. Meaning the text " Words" work only.
20th Apr 2018, 3:44 PM
Alquen
Alquen - avatar
+ 3
Words
20th Apr 2018, 3:49 PM
Alquen
Alquen - avatar
+ 3
I am just a beginner. Any suggestion sir? That might also help me.
20th Apr 2018, 4:00 PM
Alquen
Alquen - avatar
+ 3
This one is better. I pasted the code from you Toni Isotalo. All credits to both of you. Thanks for the new knowledge. https://code.sololearn.com/WEXA9cWx3G0y/?ref=app
20th Apr 2018, 5:38 PM
Alquen
Alquen - avatar
+ 2
Alquen Sarmiento It just unsets the action attribute to false which is same as empty. So it will still submit but the action is the current page.
20th Apr 2018, 3:51 PM
Toni Isotalo
Toni Isotalo - avatar
+ 2
With the knowledge I know, I think JS is needed
20th Apr 2018, 5:30 PM
Alquen
Alquen - avatar
0
Alquen Sarmiento , what's the password for your form?
20th Apr 2018, 3:48 PM
Ravindra Desai
Ravindra Desai - avatar
0
thanks..but can't i do it with html?
20th Apr 2018, 3:50 PM
Ravindra Desai
Ravindra Desai - avatar
0
can i use html for the same Alquen Sarmiento ?
20th Apr 2018, 4:21 PM
Ravindra Desai
Ravindra Desai - avatar