Projekt

Obecné

Profil

« Předchozí | Další » 

Revize d99d8a5b

Přidáno uživatelem Ondřej Anděl před téměř 4 roky(ů)

Bug #8692: Povinné prvky u modalů

Zobrazit rozdíly:

application/view/modals/editModal.html
9 9
                <div class="container">
10 10
                    <div class="row my-1">
11 11
                        <div class="col-xs-12 col-sm-4">
12
                            <label for="lemma">Lemma:</label>
12
                            <label for="lemma">Lemma: <b class="required">*</b></label>
13 13
                        </div>
14 14
                        <div class="col-xs-12 col-sm-8">
15 15
                            <input class="min-wdth" id="lemma"/>
......
17 17
                    </div>
18 18
                    <div class="row my-1">
19 19
                        <div class="col-xs-12 col-sm-4">
20
                            <label for="word">Slovo:</label>
20
                            <label for="word">Slovo: <b class="required">*</b></label>
21 21
                        </div>
22 22
                        <div class="col-xs-12 col-sm-8">
23 23
                            <input class="min-wdth" id="word"/>
......
50 50
                    </div>
51 51
                    <div class="row my-1">
52 52
                        <div class="col-xs-12 col-sm-4">
53
                            <label for="position">Pozice:</label>
53
                            <label for="position">Pozice: <b class="required">*</b></label>
54 54
                        </div>
55 55
                        <div class="col-xs-12 col-sm-8">
56 56
                            <input class="min-wdth" id="position" title="Jedotlivé oddíly zadávejte oddělené lomítkem (bez mezery)" />
......
98 98
                    </div>
99 99
                    <div class="row my-1">
100 100
                        <div class="col-xs-12 col-sm-4">
101
                            <label for="wordclass">Slovní druh:</label>
101
                            <label for="wordclass">Slovní druh: <b class="required">*</b></label>
102 102
                        </div>
103 103
                        <div class="col-xs-12 col-sm-8">
104 104
                            <select class="min-wdth" onchange="changeWordType()"  id="wordclass">
......
329 329
            changeWordType();
330 330
            modal.find('#submit-but').text("Založit");
331 331
            modal.find('#submit-but').click(() => createData(modal));
332

  
333
            enableSubmit(modal);
334
            modal.find("#lemma").change(() => enableSubmit(modal));
335
            modal.find("#word").change(() => enableSubmit(modal));
336
            modal.find("#position").change(() => enableSubmit(modal));
337
            modal.find("#wordclass").change(() => enableSubmit(modal));
332 338
        } else {
333 339
            const data_obj = data[pseudo_id];
334 340
            modal.find('#submit-but').text("Upravit");
......
338 344
            prefill(modal, data_obj);
339 345
            moodMChange(modal);
340 346
            irregularMChange(modal);
347

  
348
            enableSubmit(modal);
349
            modal.find("#lemma").change(() => enableSubmit(modal));
350
            modal.find("#word").change(() => enableSubmit(modal));
351
            modal.find("#position").change(() => enableSubmit(modal));
352
            modal.find("#wordclass").change(() => enableSubmit(modal));
341 353
        }
342 354
    });
343 355

  
......
650 662
        }
651 663
    }
652 664

  
665
    function enableSubmit(modal) {
666
        if (
667
            modal.find("#lemma")[0].value === "" ||
668
            modal.find("#word")[0].value === "" ||
669
            modal.find("#position")[0].value === "" ||
670
            modal.find("#wordclass")[0].value === ""
671
        ) {
672
            modal.find("#submit-but").prop("disabled", true);
673
        } else {
674
            modal.find("#submit-but").prop("disabled", false);
675
        }
676
    }
677

  
653 678
    function editData(data, modal){
654 679
        const formData = prepareFormData(modal);
655 680
        formData.append("id", data.id);

Také k dispozici: Unified diff