A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 113

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 280

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 145

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 223

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 303

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 344

A PHP Error was encountered

Severity: 8192

Message: setcookie(): Passing null to parameter #7 ($httponly) of type bool is deprecated

Filename: core/Input.php

Line Number: 410

jQuery ile Form Dolduğunda Submit Butonunu Aktifleştirmek
Öneri ve Hata Raporu



Günün Sözü Sevemez kimse seni benim sevdiğim kadar

oylama 2.9/5 yorum 1 yorum yazar Hakan Taşan tarih 24 Haziran 2015

Bu yazıda jQuery ile form (üyelik formu vb.) doldurulunca önceden pasif olarak ayarladığımız submit butonunu aktifleştirmeyi öğreneceğiz. Bu işlem için 2 tane input, 1 tane checkbox ve 1 tane buton olan bir form oluşturalım. Butonu en başta disabled (pasif) olarak ayarlıyoruz. Formun bütün elemanlarını doldurduğumuzda pasif olan butonu aktifleştireceğiz. Bütün kodları aşağıda bulabilirsiniz. Not: Eğer jQuery kullanmadan sadece Javascript kodu ile aynı işlemi yapmak istiyorsanız bu yazıyı okuyabilirsiniz.

Oluşturulan Form

jQuery Kodu

$(document).ready(function(){
    $("#form").on("keyup change", function(event){
        form_kontrol();
    });
});

var form_kontrol = function(){
    if($("#ad").val().length == 0)
        $("#gonder").prop("disabled", true);
    else if($("#soyad").val().length == 0)
        $("#gonder").prop("disabled", true);
    else if(!$("#kosullar").is(':checked'))
        $("#gonder").prop("disabled", true);
    else
        $("#gonder").prop("disabled", false);
}

 

HTML Kodu

<div id="uyelik_formu">
    <form id="form" action="#" method="post">
        <label>Adı:</label> 
        <input type="text" id="ad" name="ad">
        <br><br>
        <label>Soyadı:</label> 
        <input type="text" id="soyad" name="soyad">
        <br><br>
        <input type="checkbox" id="kosullar" name="kosullar">Kullanım koşullarını kabul ediyorum.
        <br><br>
        <button type="submit" id="gonder" disabled>Gönder</button>
    </form>
</div>

 

CSS Kodu

#uyelik_formu
{
    padding: 10px;
    width: 350px;
    border: 1px solid black
}  
label
{          
    float: left;
    width: 150px
}

 

onizleme

paylaş Paylaş
oylama yap Oyla

makale yorumları YORUMLAR

1 Yorum


yorum

HÜSEYİN CEVAHİR

04 Ocak 2016 03:19


TEK KELİME İLE MUHTEŞEM TEŞEKKÜRLER