;

Membuat Buku Tamu

1. Membuat formulir isian buku tamu
2. Menulis isian ke daabase/basis data MS-Access
3. Menampilkan Daftar tamu




1. Membuat formulir isian buku tamu
Pada bab VII. WEB dinamic sebenarnya kita sudah membuat form isian yang sekaligus di validasi pada waktu hendak mengirimkan data ke Server.


Dibawah inilah kode HTML untuk membuat form buku tamu:
<HTML>
<HEAD>
<BODY>
<H1><FONT face="Courier New">Isi Buku Tamu</FONT> </H1>
<FONT face="Courier New">
 <FORM name="frmInput" metodhe="post"
    action= "TulisDataKeDB.asp"><BR>
   Nama  <input name="txtNama">
   <BR>
   Email <input name="txtEmail">
   <BR>  
   <BR>
   Komentar:
   <BR><TEXTAREA name=txtKomentar rows=10 cols=60></TEXTAREA>
   <br>
   <input type="button" value="OK" name="btnSubmit">
   <input type="reset" value="Batal" name="btnReset">
   <BR>
 </form>
 </FONT>
<script LANGUAGE="VBScript">
<!--
Sub btnSubmit_OnClick
 dim kesalahan
 dim objForm
 if frmInput.txtNama.value = "" then
    kesalahan=chr(13) & "Nama harus di isi"
 end if
 if instr(frmInput.txtEmail.value,"@")=0 then
    kesalahan=kesalahan & chr(13) & "Alamat email harus memiliki tanda @"
 end if
 If frmInput.txtKomentar.value="" then
   kesalahan=kesalahan & chr(13) & "Tolong Isi Komentar..."
 end if
 if kesalahan <> "" then
    Alert "Ada kesalahan isi form: " & chr(13) & kesalahan
  Else
    frmInput.submit
  End if 
End Sub
sub btnReset_OnClick
  frmInput.txtNama.value = ""
  frmInput.txtEmail.value = ""
  frmInput.txtKomentar.value = ""
end sub
-->
</script>
</BODY>
</HTML>
Bila dibuka dengan Browser (cth: Internet explorer), maka hasilnya
terlihat seperti di bawah ini:

Selanjutnya jika anda tidak mengisi apa-apa dalam kotan teks isian, lalu anda meng-klik tombol
ok, maka akan muncul layar seperti di bawah ini:

coba perhatikan kotak teks/text box  yang mucul dengan peringatan.
Ini dihasilkan dari kode di bawah ini:

<script LANGUAGE="VBScript">
<!--
Sub btnSubmit_OnClick
 dim kesalahan
 dim objForm
 if frmInput.txtNama.value = "" then
    kesalahan=chr(13) & "Nama harus di isi"
 end if
 if instr(frmInput.txtEmail.value,"@")=0 then
    kesalahan=kesalahan & chr(13) & "Alamat email harus memiliki tanda @"
 end if
 If frmInput.txtKomentar.value="" then
   kesalahan=kesalahan & chr(13) & "Tolong Isi Komentar..."
 end if
 if kesalahan <> "" then
    Alert "Ada kesalahan isi form: " & chr(13) & kesalahan
  Else
    frmInput.submit
  End if 
End Sub

No comments:

Post a Comment

Post Comments


Do you have any suggestions ? Add comment. Do not spam!

Post a Comment

Search By Google

About this blog

Vision and Mission
Assist each company to improve efficiency and effectiveness to achieve the objectives to serve clients in a professional, objective and sustainable and provide the best solutions for businesses in solving problems in the procurement of informatics and technology.

Excellence
With support from experts and experienced professionals and geared towards fulfilling the needs of clients who put quality in a cost competitif. We also work as partners culter tailored to your company's corporate and can also provide an applicable and practical advice for clients.

New

 

WELCOME

Welcome to the Thomas IPT Blog - Thank you being here, and hope you come back often. Please surf here and read more about the world of computers and various articles of the world that I experienced. There are many things about, you'll probably find something interesting.

ABOUT ME

Working as a Management Information System Design And Development Operations Accounting. Specializing in the manufacture of Retail Database Desktop Applications, ERP / MRP, KSP / KSU, Warehouse, etc by using VB, SQL, Access, Crystal Report

NAVIGASI

SOCIAL STUFF

Info