@Tegarsetyo6
Submitted
I still don't understand how to create the correction feature to stop form from submitting and show warning when form input is not appropriate
Looking to hire developers?
@simeydotme
@Tegarsetyo6
Submitted
I still don't understand how to create the correction feature to stop form from submitting and show warning when form input is not appropriate
@simeydotme
Posted
To prevent the form from submitting if Validation is not passed, you may use an onsubmit
event on the <form>
element ( <form onsubmit='checkValidation'>
) instead of using a onclick
event on the <button>
... then you can check if the form has not passed validation. You can return false
or event.preventDefault
inside of the checkValidation
event handler to stop the form from submitting on error.
More information can be found on mozdev; https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit_event#javascript
Hope that is helpful!
Marked as helpful
@CharmaineHYM
Submitted
i used a library call Maska to split credit card number into 4 segments, do you have any better idea to format credit card number input?
@simeydotme
Posted
You could consider setting a "pattern" attribute and "inputmode" attribute on the card number <input> so that it allows easier input on mobile devices :)
Aside from that the thing looks great! Good job! You've followed the design very well and the mobile view looks perfect!