필수입력 해결중

This commit is contained in:
gnuboard
2012-12-26 18:02:36 +09:00
parent 57abd4ac0f
commit 120be1872f
2 changed files with 17 additions and 10 deletions

View File

@ -216,8 +216,8 @@ function wrestExtension(fld, css)
{
if (!wrestTrim(fld)) return;
var str = css.split('='); // ext=?? <-- str[1]
var src = fld.value.split('.');
var str = css.split("="); // ext=?? <-- str[1]
var src = fld.value.split(".");
var ext = src[src.length - 1];
if (wrestFld == null) {
@ -255,7 +255,11 @@ function wrestSubmit()
// Input tag 의 type 이 text, file, password 일때만
// 셀렉트 박스일때도 필수 선택 검사합니다. select-one
if (el.type=='text' || el.type=='hidden' || el.type=='file' || el.type=='password' || el.type=='select-one' || el.type=='textarea') {
if (el.type=="text" || el.type=="hidden" || el.type=="file" || el.type=="password" || el.type=="select-one" || el.type=="textarea") {
if (el.getAttribute("required") != null) {
wrestRequired(el);
}
var array_css = el.className.split(' '); // class 를 공백으로 나눔
el.style.backgroundColor = wrestFldDefaultColor;
@ -296,9 +300,9 @@ function wrestSubmit()
// 경고메세지 출력
alert(wrestMsg);
if (wrestFld.style.display != 'none') {
if (wrestFld.style.display != "none") {
wrestFld.style.backgroundColor = wrestFldBackColor;
if (typeof(wrestFld.select) != 'undefined')
if (typeof(wrestFld.select) != "undefined")
wrestFld.select();
wrestFld.focus();
}
@ -320,12 +324,15 @@ function wrestInitialized()
for (var i = 0; i < document.forms.length; i++) {
// onsubmit 이벤트가 있다면 저장해 놓는다.
if (document.forms[i].onsubmit) document.forms[i].oldsubmit = document.forms[i].onsubmit;
if (document.forms[i].onsubmit) {
document.forms[i].oldsubmit = document.forms[i].onsubmit;
}
document.forms[i].onsubmit = wrestSubmit;
for (var j = 0; j < document.forms[i].elements.length; j++) {
// 필수 입력일 경우는 * 배경이미지를 준다.
if (document.forms[i].elements[j].getAttribute("required") != null) {
if (document.forms[i].elements[j].getAttribute("required") != null ||
regexp.test(document.forms[i].elements[j].className)) {
//if (regexp.test(document.forms[i].elements[j].className)) {
//document.forms[i].elements[j].style.backgroundColor = wrestFldDefaultColor;
//document.forms[i].elements[j].className = "wrest_required";

View File

@ -8,7 +8,7 @@ var char_min = parseInt(<?=$write_min?>); // 최소
var char_max = parseInt(<?=$write_max?>); // 최대
</script>
<form id="fwrite" action="./write_update.php" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data">
<form id="fwrite" name="fwrite" action="./write_update.php" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data">
<input type="hidden" name="w" value="<?=$w?>">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="wr_id" value="<?=$wr_id?>">
@ -26,14 +26,14 @@ var char_max = parseInt(<?=$write_max?>); // 최대
<? if ($is_name) { ?>
<tr>
<th scope="row"><label for="wr_name">이름</label></th>
<td><input type="text" id="wr_name" name="wr_name" maxlength="20" required="required" value="<?=$name?>"></td>
<td><input type="text" id="wr_name" name="wr_name" maxlength="20" class="required" value="<?=$name?>" title="이름"></td>
</tr>
<? } ?>
<? if ($is_password) { ?>
<tr>
<th scope="row"><label for="wr_password">패스워드</label></th>
<td><input type="password" id="wr_password" name="wr_password" maxlength="20" <?=$password_required?>></td>
<td><input type="password" id="wr_password" name="wr_password" maxlength="20" <?=$password_required?> title="패스워드"></td>
</tr>
<? } ?>