0
Help regarding forms in html
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? i want to know how can it be done using ONLY HTML not using other languages https://code.sololearn.com/WrauOVPc3OxH/?ref=app
11 Respuestas
+ 2
Those are event handlers.
onclick, ondrag, onload etc.
+ 1
html is markup language.
so if you want to control the flow of submit, you need to apply some scripts by adding <script> tag or using event listener.
----try this code below----
this is an example using onclick event listener with not submit type input but button. (submit condition: type 'abc' on password input)
<!DOCTYPE html>
<html>
<form action="https:/www.sololearn.com">
<input type="checkbox"value="password" name="password"
>sololearn</input><br />
password: <input type="password" />
<input type="button" value="submit" onclick="if(document.querySelector('[type=\'password\']').value == 'abc') submit();"/>
</form>
</html>
+ 1
in your code, what are the statements included after the value attribute? are those some sort of functions? and i have html5 yet to learn on sololearn... will those functions be included in those lessons?
+ 1
oh it's alright.. thanks for sharing your knowledge
+ 1
Ravindra Desai no HTML5 tutorial doesn't teach about event handlers, not in sololearn Html course. Its in the javascript course.
You can also check
https://www.w3schools.com
0
You need javascript for that. There is form validation course in the learning section of js.
0
so they will be included in html5 lessons on sololearn.. isn't it???
0
the value of input type 'button' means object's display name.
0
DOES HTML5 COURSE IN SOLOLEARN INCLUDE ONCLICK,ONDRAG AND OTHER EVENT HANDLERS?
0
i don't know well the sololearn course includes those handlers.
i learned the html on other courses.
0
oh ok.. thanks..but those event handlers can be used in html right?