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
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
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
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
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
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
Severity: 8192
Message: setcookie(): Passing null to parameter #7 ($httponly) of type bool is deprecated
Filename: core/Input.php
Line Number: 410
Bu yazıda jQuery ile sadece sayısal değerlerin girilebileceği bir input alanı oluşturmayı öğreneceğiz. Input alanına sadece rakam girilebilecek, rakam dışındaki karakter yazımlarına izin verilmeyecek. Bunun için Regular Expression’lardan yararlanacağız. Oluşturacağımız form görüntüsünde input alanı sayısal değer olmadığında uyarı yazısı verecek. Aynı örneği Javascript ile yapmak istiyorsanız bu yazıyı okuyabilirsiniz.
Oluşturulan Form Görüntüsü
jQuery Kodu
$(document).ready(function(){
$("#sayisal").on("keypress", function(event){
if(event.keyCode != 8 && event.keyCode != 0 && (event.keyCode < 48 || event.keyCode > 57))
return false;
});
$("#sayisal_form").on("keyup", function(event){
form_kontrolu();
});
});
var form_kontrolu = function(){
var sayisal = $("#sayisal").val();
var numReg = /^[0-9]+$/gm;
if(!numReg.test(sayisal) || sayisal==null || sayisal=="")
$('.uyari').html("Bu alan sadece rakamlardan oluşmalı");
else
{
$('.uyari').empty();
$('#sayisal_form').removeAttr('onsubmit');
}
return false;
}
HTML Kodu
<div id="uyelik_formu">
<form name="form" id="sayisal_form" action="#" method="post" onsubmit="return false;">
<label>Sayısal Alan:</label>
<input type="text" id="sayisal" name="sayisal">
<br><br>
<input type="submit" value="Kaydet">
</form>
<br>
<div class="uyari"></div>
</div>
YORUMLAR