File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
DigitalLearningSolutions.Web/Scripts/frameworks Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -50,27 +50,34 @@ function topicChanged() {
5050 if ( style === 'block' ) {
5151 tb . value = '' ;
5252 tb . required = true ;
53+ tb . setCustomValidity ( "" ) ;
5354 tb . focus ( ) ;
5455 } else {
56+ tb . value = "" ;
57+ tb . setCustomValidity ( "" ) ;
5558 tb . required = false ;
5659 }
5760}
5861const form = document . querySelector ( "form" ) as HTMLFormElement ;
5962const bfield = < HTMLInputElement > document . getElementById ( 'brand-field' ) ;
6063const cfield = < HTMLInputElement > document . getElementById ( 'category-field' ) ;
64+ const tfield = < HTMLInputElement > document . getElementById ( 'topic-field' ) ;
6165function wireClearOnInput ( input : HTMLInputElement ) {
6266 input . addEventListener ( "input" , ( ) => {
6367 input . setCustomValidity ( "" ) ;
6468 } ) ;
6569}
6670
67- wireClearOnInput ( bfield ) ;
68- wireClearOnInput ( cfield ) ;
71+ if ( bfield ) wireClearOnInput ( bfield ) ;
72+ if ( cfield ) wireClearOnInput ( cfield ) ;
73+ if ( tfield ) wireClearOnInput ( tfield ) ;
74+
6975
7076form . addEventListener ( "submit" , ( e : Event ) => {
7177 const fields = [
7278 { el : bfield , msg : "Please enter a valid brand." } ,
73- { el : cfield , msg : "Please enter a valid category." }
79+ { el : cfield , msg : "Please enter a valid category." } ,
80+ { el : tfield , msg : "Please enter a valid topic." }
7481 ] ;
7582
7683 for ( const f of fields ) {
You can’t perform that action at this time.
0 commit comments