PEAK XOOPS - ミニ白扇の入力必須チェック例(Re: ミニ白扇の使い方 (1)) in englishin japanese

ミニ白扇の入力必須チェック例(Re: ミニ白扇の使い方 (1))

Target News
Subject ミニ白扇の使い方 (1)
Summary XOOPS 2.0.x用モジュールとして放流しておきながら、あまりにもおざなりなドキュメントで申し訳なかったのですが、一応、ミニ白扇の使い方を書いておきます。第1回は、登録画面とアカウント編集画面だけをカスタマイズしたい(それも項目の追加はなく、デザイン変更もし...

List posts in the topic

none ミニ白扇の入力必須チェック例(Re: ミニ白扇の使い方 (1))

msg# 1
depth:
0
Previous post - Next post | Parent - Children.1 | Posted on 2007/1/9 8:10 | Last modified
jidaikobo  上等兵   Posts: 26
ミニ白扇の入力チェック例を考えてみまして、なんだか一見うまく動いているようなので、ご笑覧いただけたらとおもい。
die するんだったら config.php で完結するのかなーと思うんですが、せっかくなので、XOOPS の表示にあわせられないかなといじってみたんですが、僕のできるようにやろうとすると、registerhook.php をいじらずにはできませんでした
間抜けなことをしていたらごめんなさい。

■config.php(エラーを日本語で返すときは EUC で保存)
// request maintenances
$stop_reason_extra_fields = '';

if( ! empty( $_POST['do_register'] )){
	if($_POST['code_a']==''){
		$stop_reason_extra_fields .= "コードAは入力必須項目です。<br />";
	}
	if($_POST['code_b']==''){
		$stop_reason_extra_fields .= "コードBは入力必須項目です。<br />";
	}
}

■registerhook.php l53付近
if( ! empty( $_POST['do_register'] ) && ! ( $stop_reason = userCheck( $allowed_requests['uname'] , $email4check , $allowed_requests['pass'] , $allowed_requests['vpass'] ) ) && $stop_reason_extra_fields=='' ) {

■registerhook.php l161付近
	include XOOPS_ROOT_PATH.'/header.php' ;
+	$stop_reason .= $stop_reason_extra_fields;
	$xoopsOption['template_main'] = 'minihaku_register.html' ;

--追加です。
■edituserhook.php l86付近
アカウントの編集でも config で設定したエラーを表示する場合。
+	if (!$stop_reason_extra_fields == ''){
+		$errors[] = $stop_reason_extra_fields;
+	}
	if (count($errors) > 0) {

--shamefull typoがあったので、こっそり修正(fieldsの綴り)。
Votes:3 Average:6.67

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!