ALNMOO
asked on
GET works fine but post doesn't Work!!!!
Hi experts,
In my ASP page, there is a form when I put its method to be get I change the call the variables by request.QueryString("V1") it works fine.
When I change only the method to be post I change the call to be request.form("V1") it doesn't work!!!
Why this could happen?
Can you post a sample ?
ASKER
the code is very huge and complicated.
I only meant a sample of the form declaration and a field, to demonstrate how you are currently attempting to retrieve the value.
ASKER
The following code when I am using post and doesn't work:
response.Write(request.For
<form name="frm" method="post" >
<table>
<tr>
<td></td>
<td><input class="testFiled" class="Butto" type="submit" name="GO"value="Update"> </td>
<td></td>
<td> <input class="testFiled" class="Butto" type="reset" value="Reset"></td>
<td></td>
</tr>
</table>
</form>
--------------------------
The following code when I am using get and it works fine:
response.Write(request.Que
<form name="frm" method="get" >
<table>
<tr>
<td></td>
<td><input class="testFiled" class="Butto" type="submit" name="GO"value="Update"> </td>
<td></td>
<td> <input class="testFiled" class="Butto" type="reset" value="Reset"></td>
<td></td>
</tr>
</table>
</form>
You need to define what you want the form to do when submitted:
<form name="frm" method="post" action="NameOfThisModule.a sp">
<form name="frm" method="post" action="NameOfThisModule.a
ASKER
but the default value of acction is the same page and this is what I want.
I am surprised why it works with get while it doesn't work with post!!!
I am surprised why it works with get while it doesn't work with post!!!
ASKER
sory :-)
I mean action.
and to be sure I tested with action set to be same page and was same.
I mean action.
and to be sure I tested with action set to be same page and was same.
The only thing else I can think of is to remove the outer parenthesis in the response.Write. I don't think that is the problem but I don't use parens in VBScript objects. If parens are not allowed I would think you would have gotten an error, though.
response.Write request.Form("GO")
response.Write request.Form("GO")
Try writing out the entire Form and seeing what you get:
Response.Write Request.Form
Response.Write Request.Form
ASKER
Response.Write Request.Form
no repsonse as if it not there!!
no repsonse as if it not there!!
ASKER
I removed the outer parenthesis and it is same!
try assigning the id attribute as well as the name attribute.
<form name="frm" method="post" >
<table>
<tr>
<td></td>
<td><input class="testFiled" class="Butto" type="submit" name="GO" id="GO" value="Update"> </td>
<td></td>
<td> <input class="testFiled" class="Butto" type="reset" value="Reset"></td>
<td></td>
</tr>
</table>
</form>
-------------------------- ---------- ---------- ----------
The following code when I am using get and it works fine:
response.Write(request.Que ryString(" GO"))
<form name="frm" method="get" >
<table>
<tr>
<td></td>
<td><input class="testFiled" class="Butto" type="submit" name="GO" id="GO" value="Update"> </td>
<td></td>
<td> <input class="testFiled" class="Butto" type="reset" value="Reset"></td>
<td></td>
</tr>
</table>
</form>
<form name="frm" method="post" >
<table>
<tr>
<td></td>
<td><input class="testFiled" class="Butto" type="submit" name="GO" id="GO" value="Update"> </td>
<td></td>
<td> <input class="testFiled" class="Butto" type="reset" value="Reset"></td>
<td></td>
</tr>
</table>
</form>
--------------------------
The following code when I am using get and it works fine:
response.Write(request.Que
<form name="frm" method="get" >
<table>
<tr>
<td></td>
<td><input class="testFiled" class="Butto" type="submit" name="GO" id="GO" value="Update"> </td>
<td></td>
<td> <input class="testFiled" class="Butto" type="reset" value="Reset"></td>
<td></td>
</tr>
</table>
</form>
ASKER
the id attribute doesn't solve it
Try this and see if you at least get a value. If you do them dig into the two class definitions (testFiled & Butto) and see if there is something wrong with them.
<input class='Button' type='submit' name='GO' value='UpDate'>"
<input class='Button' type='submit' name='GO' value='UpDate'>"
response.Write("querystrin g value: " & request.QueryString("GO") & ":end")
response.Write("post value: " & request.form("GO") & ":end")
try them like this and lets make sure that the line is getting processed. you should be getting the text without a value.
response.Write("post value: " & request.form("GO") & ":end")
try them like this and lets make sure that the line is getting processed. you should be getting the text without a value.
ASKER
I rremoved the calss tag but still same, no output
ASKER
I tried response.Write("post value: " & request.form("GO") & ":end")
Yes the line is processed.
Is there any possibility that this error from IIS?
Yes the line is processed.
Is there any possibility that this error from IIS?
what if you add a text box with a value. does it show that textbox's value?
ASKER
yes
As a test..the following code works perfectly on my server.
<%
If Request("Go") <> "" Then
Response.Write "Submit Value = " & Request("Go") & "<BR><BR>"
End If
%>
<FORM method='post'>
<INPUT type='submit' name='Go' value='Update'>
<INPUT type='submit' name='Go' value='Add New'>
</FORM>
<%
If Request("Go") <> "" Then
Response.Write "Submit Value = " & Request("Go") & "<BR><BR>"
End If
%>
<FORM method='post'>
<INPUT type='submit' name='Go' value='Update'>
<INPUT type='submit' name='Go' value='Add New'>
</FORM>
ASKER
I just test your code and doesn't work
>> ALNMOO
Everyone here has thrown out the most basic and probable solutions...
Are you posting to the same page or a different page? And I know you said your code is huge, but if it doesn't have any database connectivity stuff in it, can you zip it up and put it on your server so we can all download it.
Maybe its something else before the submit control gets processed that's causing it to get out of whack.
Everyone here has thrown out the most basic and probable solutions...
Are you posting to the same page or a different page? And I know you said your code is huge, but if it doesn't have any database connectivity stuff in it, can you zip it up and put it on your server so we can all download it.
Maybe its something else before the submit control gets processed that's causing it to get out of whack.
ASKER
The probelm is my page connected to our DC and has LDAP query. also it is interinal site.
He's got a more serious problem if my simple form coding isn't working for him. When I run it I and click Update then the response.write prints Update if I like add New it responses with Add New. This seems more like a browser problem or an IIS problem more than coding problem.
Ok, so the sum it up,
You can process all the fields on your form regardless of what method you use (GET or POST), except for the submit button named 'GO'? This button can only be processed if the method=GET
1) Can you try re-naming the button to something other than 'GO' to see if it works? Try:
<input type="submit" name="submit" value="Update" />
You can process all the fields on your form regardless of what method you use (GET or POST), except for the submit button named 'GO'? This button can only be processed if the method=GET
1) Can you try re-naming the button to something other than 'GO' to see if it works? Try:
<input type="submit" name="submit" value="Update" />
try sticking this in there too to see if we get a result for this.
response.write("METHOD: " & Request.ServerVariables("R EQUEST_MET HOD"))
response.write("METHOD: " & Request.ServerVariables("R
but your code works fine for me.i tried this way :
<%
response.Write(request.For m("GO"))
%>
<form name="frm" method="post" >
<table>
<tr>
<td></td>
<td><input class="testFiled" class="Butto" type="submit" name="GO"value="Update"> </td>
<td></td>
<td> <input class="testFiled" class="Butto" type="reset" value="Reset"></td>
<td></td>
</tr>
</table>
</form>
when i click on submit button it shows correct result:
Update
[ Update ] [Reset] <--- Buttons
<%
response.Write(request.For
%>
<form name="frm" method="post" >
<table>
<tr>
<td></td>
<td><input class="testFiled" class="Butto" type="submit" name="GO"value="Update"> </td>
<td></td>
<td> <input class="testFiled" class="Butto" type="reset" value="Reset"></td>
<td></td>
</tr>
</table>
</form>
when i click on submit button it shows correct result:
Update
[ Update ] [Reset] <--- Buttons
i mean when i click on Update button it shows correct result:
Update
Update
ASKER
jrram
correction, with post I cann't process any field not only GO.
I tried a different names for this fileds but still, same error
correction, with post I cann't process any field not only GO.
I tried a different names for this fileds but still, same error
ASKER
This is very strange!!!
It is working now without touching any thing!!!!
It seems that it is IE or IIS problem!
any one faced this problem before? any why this may happen?
It is working now without touching any thing!!!!
It seems that it is IE or IIS problem!
any one faced this problem before? any why this may happen?
I've never encountered this particular situation ALNMOO, but I have run into other situations where some of my code was perfectly fine and wouldn't work. In those situations, I typically just restarted IIS and it resolved the problems.
I'm not a Microsoft basher, but we all know some of their products can be quirky sometimes ;-)
I'm not a Microsoft basher, but we all know some of their products can be quirky sometimes ;-)
ASKER
But the problem solved without even restart IIS!!
if ur method is POST <form action="test.asp" method="POST" >
u want to use request.Form("value")
else if ur method is GET <form action="test.asp" method="GET" >
request.QueryString("value "))
if u dont know what method u use ?? u can make
>>> request("value") <<<<
this the best if u dont know what the method u used
u want to use request.Form("value")
else if ur method is GET <form action="test.asp" method="GET" >
request.QueryString("value
if u dont know what method u use ?? u can make
>>> request("value") <<<<
this the best if u dont know what the method u used
ASKER
dear all,
still I didn't discover why this probelm happened?
some times it works and some times doesn't work
still I didn't discover why this probelm happened?
some times it works and some times doesn't work
reinstall IIS/PWS. hope it wil fix your problem
lets narrow it down. try using a different pc to post these values. do you get the same results?
ASKER
yes,
I tried from another PC, and I get same probelm
I tried from another PC, and I get same probelm
If you haven't already. Create a new file on your server and put my coding above in it and see if it functions or fails. If it fails then you obviously have a server installation problem. I did some research on the Net and didn't find any references to this type of problem. I would recommend removing IIS, then re-installing it. Make sure you have a good backup and consider this a learning experience. :)
This could very much be a sign of a larger problem with IIS. I wouldn't just trying working around the problem as you don't know how this is effecting other applications on your site.
This could very much be a sign of a larger problem with IIS. I wouldn't just trying working around the problem as you don't know how this is effecting other applications on your site.
ASKER
This the code that do the problem,
============
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Update Your Information</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<!-- #include file="conn.asp" -->
<script language="javascript">
function hide(){
document.frm.hr.value="out source";
document.getElementById("t 1").style. display="n one";
}
function view(){
document.frm.hr.value="";
document.getElementById("t 1").style. display="b lock";
}
</script>
<body bgcolor="#1C4299">
<!-- #include file="header.txt" -->
<%
'================== // =================
session("LogonName") = "0021112"
'========= Query LDAP ===========
'Searching in AD using the logon name & LDAP
IF session("LogonName") <> "" Then
Const ADS_SCOPE_SUBTREE = 3
Set objConnection = CreateObject("ADODB.Connec tion")
Set objCommand = CreateObject("ADODB.Comman d")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnectio n = objConnection
objCommand.Properties("Pag e Size") = 1000
objCommand.Properties("Sea rchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT ADsPath FROM 'LDAP://dc=alrajhi,dc=bank ' WHERE objectCategory='user' " & _
"AND sAMAccountName='" & session("LogonName") & "'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
'response.Write(objRecordS et.Fields( "ADsPath") .Value)
dir = objRecordSet.Fields("ADsPa th").Value
Set objOU = GetObject(dir)
objRecordSet.MoveNext
Loop
ELSE
response.Redirect("default .asp")
END IF
'========== Reset Redirect =======
IF request.Form("reset") = "Reset" THEN
response.Redirect("default .asp")
END IF
'========= Validate Data =========
if request.form("GO") = "Update" THEN
un = session("LogonName")
una = request.Form("userName")
ext = request.Form("ext")
hr = request.Form("hr")
office = request.Form("office")
dept = request.Form("dept")
titl = request.Form("Title")
OldName = request.Form("OldName")
OldOffice = request.Form("OldOffice")
OldDept = request.Form("OldDept")
OldTitle = request.Form("OldTitle")
OldExt = request.Form("OldExt")
RE = request.Form("RE")
'====== error Code ======
rro = "00000000000000"
' 1."10000000000000" => not chars or . - in the name
' 2."01000000000000" => more than 30 chars in the name
' 3."00100000000000" => less than 4 digits in phone number
' 4."00010000000000" => more than 10 digits in phone number
' 5."00001000000000" => not digits in phone number
' 6."00000100000000" => No Dept name
' 7."00000010000000" => Only chars in Dept name
' 8."00000001000000" => no more 10 digits and less than 3 digits office
' 9."00000000100000" => You have to insert HR number
' 10."00000000010000"=> Only digits in HR number
' 11."00000000001000"=> only digits in Office number
' 12."00000000000100"=> You have to fill your name
' 13."00000000000010"=> Title contains only charchters
' 14."00000000000001"=> ??
'------- check the user name ------
IF Len(una) < 4 THEN
orError(12)
END IF
f = 0
For x = 1 To Len(una)
y = ASC(Mid(una, x, 1))
If not (y = 32 or y = 45 or y = 46 or (y >64 and y < 91) or (y >96 and y < 123)) Then
f = 1
End If
Next
IF f = 1 THEN
orError(1)
END IF
IF Len(una) > 30 THEN
orError(2)
END IF
'========================= ========== ======
IF Len(ext) < 4 THEN
orError(3)
END IF
IF Len(ext) > 10 THEN
orError(4)
END IF
IF not IsNumeric(ext) THEN
orError(5)
END IF
' =========================
IF Len(dept) < 4 THEN
orError(6)
END IF
f1 = 0
For x = 1 To Len(dept)
y = ASC(Mid(dept, x, 1))
If not (y = 32 or (y >64 and y < 91) or (y >96 and y < 123)) Then
f1 = 1
End If
Next
IF f1 = 1 THEN
orError(7)
END IF
'========================= ========== ====
f1 = 0
For x = 1 To Len(titl)
y = ASC(Mid(titl, x, 1))
If not (y = 32 or (y >64 and y < 91) or (y >96 and y < 123)) Then
f1 = 1
End If
Next
IF f1 = 1 THEN
orError(13)
END IF
' ========================== ========== ==
IF RE = "yes" THEN
IF hr = "" THEN
orError(9)
ELSE
IF not IsNumeric(hr) THEN
orError(10)
END IF
END IF
END IF
'========================= ========== ===
IF (Len(office) < 3) or (Len(office) > 10)THEN
orError(8)
END IF
f2 = 0
For x = 1 To Len(office)
y = ASC(Mid(office, x, 1))
If (y < 48) or (y > 57) Then
f2 = 1
End If
Next
IF f2 = 1 THEN
orError(11)
END IF
'========================= =========
'================= functions ======
function orError (b)
tmp = ""
For x = 1 To len(rro)
y = Mid(rro, x, 1)
if x = b THEN
tmp = tmp + "1"
ELSE
tmp = tmp + y
End If
Next
rro = tmp
END function
function IsError (d)
IsError = false
y = Mid(rro, d, 1)
if y = "1" THEN
IsError = true
End If
END function
IF not (IsError(1) or IsError(2) or IsError(3) or IsError(4) or IsError(5) or IsError(6) or IsError(7) or IsError(8) or IsError(9) or IsError(10) or IsError(11) or IsError(12) or IsError(13)) THEN
session("una") = una
session("ext") = ext
session("hr") = hr
session("office") = office
session("dept") = dept
session("titl") = titl
session("OldName") = OldName
session("OldOffice") = OldOffice
session("OldDept") = OldDept
session("OldTitle") = OldTitle
session("OldExt") = OldExt
session("RE") = RE
response.Redirect("update. asp")
END IF
ELSE
un = session("LogonName")
una = objOU.displayName
ext = objOU.telephoneNumber
hr = request.Form("hr")
office = objOU.physicalDeliveryOffi ceName
dept = objOU.department
titl = objOU.Title
OldName = request.Form("OldName")
OldOffice = request.Form("OldOffice")
OldDept = request.Form("OldDept")
OldTitle = request.Form("OldTitle")
OldExt = request.Form("OldExt")
RE = request.Form("RE")
END IF
%>
<div align="center">
<fieldset title="Update Your Information">
<legend class="legend_title">Updat e Your Information حدث معل  8;م& #1575; 78;ك </legend>
<form action="index.asp" name="frm" method="post" >
<table>
<tr>
<td align="left" class="titleEffects">Logon Name:</td>
<td></td>
<td class="titleEffects" align="center"><%= session("LogonName")%></td >
<td></td>
<td align="right" dir="rtl" class="titleEffects">ž 5;م& #1586; الش 6;ك& #1577;:</t d>
</tr>
<tr>
<td align="left" class="titleEffects">User Name:</td>
<td></td>
<td class="titleEffects" align="center"><input name="userName" maxlength="30" <%IF IsError(12) or IsError(1) or IsError(2) THEN response.Write("class='wro ngField'") ELSE response.Write("class='tes tFiled'") END IF %> type="text" value="<%=una%>"></td>
<td><%IF IsError(12) or IsError(1) or IsError(2) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects"> 5;س& #1605; المž 7;ت& #1582; 83;م :</td>
</tr>
<tr>
<td align="left" class="titleEffects">Offic e:</td>
<td></td>
<td><input name="office" maxlength="10" <%IF IsError(11) or IsError(8) THEN response.Write("class='wro ngField'") ELSE response.Write("class='tes tFiled'") END IF %> type="text" value="<%=office%>"></td>
<td><%IF IsError(11) or IsError(8) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects">ž 5;ق& #1605; الم  3;ت& #1576;:</t d>
</tr>
<tr>
<td align="left" class="titleEffects">Depar tment:</td >
<td></td>
<td><input <%IF IsError(6) or IsError(7) THEN response.Write("class='wro ngField'") ELSE response.Write("class='tes tFiled'") END IF %> maxlength="50" name="dept" type="text" value="<%=dept%>"></td>
<td><%IF IsError(6) or IsError(7) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects"> 5;ل& #1573; 83;ا ر 577;:</td>
</tr>
<tr>
<td align="left" class="titleEffects">Title (Optional) :</td>
<td></td>
<td><input <%IF IsError(13) THEN response.Write("class='wro ngField'") ELSE response.Write("class='tes tFiled'") END IF %> maxlength="30" name="Title" type="text" value="<%=titl%>"></td>
<td><%IF IsError(13) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects"> 5;ل& #1605; 87;م ى الوŸ 2;ي& #1601; 10;: (اخت 10;ا ر 610;)</td>
</tr>
<tr>
<td align="left" class="titleEffects">Telep hone Number:</td>
<td></td>
<td><input <%IF IsError(5) or IsError(3) or IsError(4) THEN response.Write("class='wro ngField'") ELSE response.Write("class='tes tFiled'") END IF %> maxlength="10" name="ext" maxlength="10" type="text" value="<%=ext%>"></td>
<td><%IF IsError(5) or IsError(3) or IsError(4) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects">ž 5;ق& #1605; اله 5;ت& #1601;:</t d>
</tr>
<tr>
<td align="left" class="titleEffects">Are you Alrajhi Employee?</td>
<td></td>
<td><input type="radio" name="RE" value="yes" onClick="view()" checked><font class="titleEffects">Yes/& #1606; 93;م </font>
<input type="radio" name="RE" value="no" onClick="hide()"><font class="titleEffects">NO/&# 1604; 5;</font>< /td>
<td></td>
<td align="right" dir="rtl" class="titleEffects">  7;ل أنت موظ  1; في المž 9;ر& #1601; 67;</td>
</tr>
<tr id="t1">
<td align="left" class="titleEffects">HR Number:</td>
<td></td>
<td><input <%IF IsError(9) or IsError(10)THEN response.Write("class='wro ngField'") ELSE response.Write("class='tes tFiled'") END IF %> maxlength="10" name="hr" type="text"></td>
<td><%IF IsError(9) or IsError(10) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects"> 5;ل& #1585; 02;م الوŸ 2;ي& #1601; 10;:</td>
</tr>
<tr>
<td>
</td>
<td>
<input class="testFiled" class="Butto" type="submit" name="GO" value="Update" id="GO"> </td>
<td>
</td>
<td>
<input class="testFiled" name="reset" class="Butto" type="submit" value="Reset">
</td>
<td>
</td>
</tr>
</table>
<input type="hidden" name="OldName" value="<%=objOU.displayNam e%>">
<input type="hidden" name="OldOffice" value="<%=objOU.physicalDe liveryOffi ceName %>">
<input type="hidden" name="OldDept" value="<%=objOU.department %>">
<input type="hidden" name="OldTitle" value="<%=objOU.Title%>">
<input type="hidden" name="OldExt" value="<%=objOU.telephoneN umber%>">
<input type="hidden" name="" value="<%=objOU.telephoneN umber %>">
</form>
<br>
</fieldset>
<br>
<%
IF rro <> "00000000000000" THEN
'response.Write(IsError(13 ) & "<BR>" & titl)
%>
<table width="90%" border="1" bordercolor="#1C4299">
<tr>
<td align="left" bordercolor="#FFFFFF" bgcolor="#FF0000" class="rror" width="50%">
<ol>
<% IF IsError(12) THEN %><li><font class="rror">User name cann't be empty</font></li> <% END IF%>
<% IF IsError(1) THEN %><li><font class="rror">User name can contain only characters,'.' and '-'</font></li><% END IF%>
<% IF IsError(2) THEN %><li><font class="rror">User name cann't be more than 30 characters</font></li><% END IF%>
<% IF IsError(8) THEN %><li><font class="rror">Office number has to be between 10 digits and 4 digits</font></li><% END IF%>
<% IF IsError(11) THEN %><li><font class="rror">Office number has to be digits only</font></li><% END IF%>
<% IF IsError(6) THEN %><li><font class="rror">Department name cann't be empty</font></li><% END IF%>
<% IF IsError(7) THEN %><li><font class="rror">Department name can contain only characters</font></li><% END IF%>
<% IF IsError(13) THEN %><li><font class="rror">The Title can contain only characters</font></li><% END IF%>
<% IF IsError(5) THEN %><li><font class="rror">Phone number can contain only digits</font></li><% END IF%>
<% IF IsError(3) THEN %><li><font class="rror">Phone number cann't be less than 4 digits </font></li><% END IF%>
<% IF IsError(4) THEN %><li><font class="rror">Phone number cann't be more than 10 digits</font></li><% END IF%>
<% IF IsError(9) THEN %><li><font class="rror">HR number is required if you Alrajhi Bank Employee</font></li><% END IF%>
<% IF IsError(10) THEN %><li><font class="rror">HR number has to be digits only</font></li><% END IF%>
</ol>
</td>
<td align="right" dir="rtl" bordercolor="#FFFFFF" bgcolor="#FF0000" class="rror" width="50%">
<ol>
<% IF IsError(12) THEN %><li><font class="rror">يج ;ب تعب 4;ة اسم المž 7;ت& #1582; 83;م </font></l i><% END IF%>
<% IF IsError(1) THEN %><li><font class="rror">يم ;ك&# 1606; أن يحت  8;ي اسم المž 7;ت& #1582; 83;م على أحر  1; إنج  4;ي& #1586; 10;ة أو ‘.‘ أو ‘-‘</font></li><% END IF%>
<% IF IsError(2) THEN %><li><font class="rror">لا ; يمك  6; أن يزيž 3; اسم المž 7;ت& #1582; 83;م عن 30 حرف</fon t></li><% END IF%>
<% IF IsError(8) THEN %><li><font class="rror">رق ;م الم  3;ت& #1576; يجب أن لا يقل عن أربŸ 3;ة أرق 5;م< /font></li ><% END IF%>
<% IF IsError(11) THEN %><li><font class="rror">رق ;م الم  3;ت& #1576; يتك  8;ن من أرق 5;م فقط</fon t></li><% END IF%>
<% IF IsError(6) THEN %><li><font class="rror">يج ;ب تعب 4;ة حقل الإž 3;ا& #1585; 77; </font></li><% END IF%>
<% IF IsError(7) THEN %><li><font class="rror">يج ;ب أن يكت 6; اسم الإž 3;ا& #1585; 77; بال 1;ح& #1585; 01; الإ  6;ج& #1604; 10;ز ي 577;</font ></li><% END IF%>
<% IF IsError(13) THEN %><li><font class="rror">ال ;م&# 1587;  5;ى الوŸ 2;ي& #1601; 10; يجب أن يتك  8;ن من أحر  1; إنج  4;ي& #1586; 10;ة فقط.</fo nt></li><% END IF%>
<% IF IsError(5) THEN %><li><font class="rror">رق ;م اله 5;ت& #1601; يتك  8;ن من أرق 5;م فقط</fon t></li><% END IF%>
<% IF IsError(3) THEN %><li><font class="rror">يج ;ب أن يكو  6; رقم اله 5;ت& #1601; أكثž 5; من ثلا 9;ة أرق 5;م </font></li><% END IF%>
<% IF IsError(4) THEN %><li><font class="rror">لا ; يمك  6; أن يزيž 3; رقم اله 5;ت& #1601; عن عشر 7; أرق 5;م< /font></li ><% END IF%>
<% IF IsError(9) THEN %><li><font class="rror">إذ ;ا كنت من موظ  1;ي الر 5;ج& #1581; 10;، فيج 6; تعب 4;ة الر  2;م الوŸ 2;ي& #1601; 10;</font> </li><% END IF%>
<% IF IsError(10) THEN %><li><font class="rror">ال ;ر&# 1602;  5; الوŸ 2;ي& #1601; 10; يتك  8;ن من أرق 5;م فقط</fon t></li><% END IF%>
</ol>
</td>
<%
' 1."10000000000000" => not chars or . - in the name
' 2."01000000000000" => more than 30 chars in the name
' 3."00100000000000" => less than 4 digits in phone number
' 4."00010000000000" => more than 10 digits in phone number
' 5."00001000000000" => not digits in phone number
' 6."00000100000000" => No Dept name
' 7."00000010000000" => Only chars in Dept name
' 8."00000001000000" => no more 10 digits and less than 3 digits office
' 9."00000000100000" => You have to insert HR number
' 10."00000000010000" => Only digits in HR number
' 11."00000000001000" => only digits in Office number
' 12."00000000000100" => You have to fill your name
' 13."00000000000010" => Title contains only charchters
' 14."00000000000001" => ??
%>
</tr>
</table>
<%
END IF
%>
</div>
</body>
</html>
============
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Update Your Information</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<!-- #include file="conn.asp" -->
<script language="javascript">
function hide(){
document.frm.hr.value="out
document.getElementById("t
}
function view(){
document.frm.hr.value="";
document.getElementById("t
}
</script>
<body bgcolor="#1C4299">
<!-- #include file="header.txt" -->
<%
'================== // =================
session("LogonName") = "0021112"
'========= Query LDAP ===========
'Searching in AD using the logon name & LDAP
IF session("LogonName") <> "" Then
Const ADS_SCOPE_SUBTREE = 3
Set objConnection = CreateObject("ADODB.Connec
Set objCommand = CreateObject("ADODB.Comman
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnectio
objCommand.Properties("Pag
objCommand.Properties("Sea
objCommand.CommandText = _
"SELECT ADsPath FROM 'LDAP://dc=alrajhi,dc=bank
"AND sAMAccountName='" & session("LogonName") & "'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
'response.Write(objRecordS
dir = objRecordSet.Fields("ADsPa
Set objOU = GetObject(dir)
objRecordSet.MoveNext
Loop
ELSE
response.Redirect("default
END IF
'========== Reset Redirect =======
IF request.Form("reset") = "Reset" THEN
response.Redirect("default
END IF
'========= Validate Data =========
if request.form("GO") = "Update" THEN
un = session("LogonName")
una = request.Form("userName")
ext = request.Form("ext")
hr = request.Form("hr")
office = request.Form("office")
dept = request.Form("dept")
titl = request.Form("Title")
OldName = request.Form("OldName")
OldOffice = request.Form("OldOffice")
OldDept = request.Form("OldDept")
OldTitle = request.Form("OldTitle")
OldExt = request.Form("OldExt")
RE = request.Form("RE")
'====== error Code ======
rro = "00000000000000"
' 1."10000000000000" => not chars or . - in the name
' 2."01000000000000" => more than 30 chars in the name
' 3."00100000000000" => less than 4 digits in phone number
' 4."00010000000000" => more than 10 digits in phone number
' 5."00001000000000" => not digits in phone number
' 6."00000100000000" => No Dept name
' 7."00000010000000" => Only chars in Dept name
' 8."00000001000000" => no more 10 digits and less than 3 digits office
' 9."00000000100000" => You have to insert HR number
' 10."00000000010000"=> Only digits in HR number
' 11."00000000001000"=> only digits in Office number
' 12."00000000000100"=> You have to fill your name
' 13."00000000000010"=> Title contains only charchters
' 14."00000000000001"=> ??
'------- check the user name ------
IF Len(una) < 4 THEN
orError(12)
END IF
f = 0
For x = 1 To Len(una)
y = ASC(Mid(una, x, 1))
If not (y = 32 or y = 45 or y = 46 or (y >64 and y < 91) or (y >96 and y < 123)) Then
f = 1
End If
Next
IF f = 1 THEN
orError(1)
END IF
IF Len(una) > 30 THEN
orError(2)
END IF
'=========================
IF Len(ext) < 4 THEN
orError(3)
END IF
IF Len(ext) > 10 THEN
orError(4)
END IF
IF not IsNumeric(ext) THEN
orError(5)
END IF
' =========================
IF Len(dept) < 4 THEN
orError(6)
END IF
f1 = 0
For x = 1 To Len(dept)
y = ASC(Mid(dept, x, 1))
If not (y = 32 or (y >64 and y < 91) or (y >96 and y < 123)) Then
f1 = 1
End If
Next
IF f1 = 1 THEN
orError(7)
END IF
'=========================
f1 = 0
For x = 1 To Len(titl)
y = ASC(Mid(titl, x, 1))
If not (y = 32 or (y >64 and y < 91) or (y >96 and y < 123)) Then
f1 = 1
End If
Next
IF f1 = 1 THEN
orError(13)
END IF
' ==========================
IF RE = "yes" THEN
IF hr = "" THEN
orError(9)
ELSE
IF not IsNumeric(hr) THEN
orError(10)
END IF
END IF
END IF
'=========================
IF (Len(office) < 3) or (Len(office) > 10)THEN
orError(8)
END IF
f2 = 0
For x = 1 To Len(office)
y = ASC(Mid(office, x, 1))
If (y < 48) or (y > 57) Then
f2 = 1
End If
Next
IF f2 = 1 THEN
orError(11)
END IF
'=========================
'================= functions ======
function orError (b)
tmp = ""
For x = 1 To len(rro)
y = Mid(rro, x, 1)
if x = b THEN
tmp = tmp + "1"
ELSE
tmp = tmp + y
End If
Next
rro = tmp
END function
function IsError (d)
IsError = false
y = Mid(rro, d, 1)
if y = "1" THEN
IsError = true
End If
END function
IF not (IsError(1) or IsError(2) or IsError(3) or IsError(4) or IsError(5) or IsError(6) or IsError(7) or IsError(8) or IsError(9) or IsError(10) or IsError(11) or IsError(12) or IsError(13)) THEN
session("una") = una
session("ext") = ext
session("hr") = hr
session("office") = office
session("dept") = dept
session("titl") = titl
session("OldName") = OldName
session("OldOffice") = OldOffice
session("OldDept") = OldDept
session("OldTitle") = OldTitle
session("OldExt") = OldExt
session("RE") = RE
response.Redirect("update.
END IF
ELSE
un = session("LogonName")
una = objOU.displayName
ext = objOU.telephoneNumber
hr = request.Form("hr")
office = objOU.physicalDeliveryOffi
dept = objOU.department
titl = objOU.Title
OldName = request.Form("OldName")
OldOffice = request.Form("OldOffice")
OldDept = request.Form("OldDept")
OldTitle = request.Form("OldTitle")
OldExt = request.Form("OldExt")
RE = request.Form("RE")
END IF
%>
<div align="center">
<fieldset title="Update Your Information">
<legend class="legend_title">Updat
<form action="index.asp" name="frm" method="post" >
<table>
<tr>
<td align="left" class="titleEffects">Logon
<td></td>
<td class="titleEffects" align="center"><%= session("LogonName")%></td
<td></td>
<td align="right" dir="rtl" class="titleEffects">ž
</tr>
<tr>
<td align="left" class="titleEffects">User Name:</td>
<td></td>
<td class="titleEffects" align="center"><input name="userName" maxlength="30" <%IF IsError(12) or IsError(1) or IsError(2) THEN response.Write("class='wro
<td><%IF IsError(12) or IsError(1) or IsError(2) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects">
</tr>
<tr>
<td align="left" class="titleEffects">Offic
<td></td>
<td><input name="office" maxlength="10" <%IF IsError(11) or IsError(8) THEN response.Write("class='wro
<td><%IF IsError(11) or IsError(8) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects">ž
</tr>
<tr>
<td align="left" class="titleEffects">Depar
<td></td>
<td><input <%IF IsError(6) or IsError(7) THEN response.Write("class='wro
<td><%IF IsError(6) or IsError(7) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects">
</tr>
<tr>
<td align="left" class="titleEffects">Title
<td></td>
<td><input <%IF IsError(13) THEN response.Write("class='wro
<td><%IF IsError(13) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects">
</tr>
<tr>
<td align="left" class="titleEffects">Telep
<td></td>
<td><input <%IF IsError(5) or IsError(3) or IsError(4) THEN response.Write("class='wro
<td><%IF IsError(5) or IsError(3) or IsError(4) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects">ž
</tr>
<tr>
<td align="left" class="titleEffects">Are you Alrajhi Employee?</td>
<td></td>
<td><input type="radio" name="RE" value="yes" onClick="view()" checked><font class="titleEffects">Yes/&
<input type="radio" name="RE" value="no" onClick="hide()"><font class="titleEffects">NO/&#
<td></td>
<td align="right" dir="rtl" class="titleEffects"> 
</tr>
<tr id="t1">
<td align="left" class="titleEffects">HR Number:</td>
<td></td>
<td><input <%IF IsError(9) or IsError(10)THEN response.Write("class='wro
<td><%IF IsError(9) or IsError(10) THEN response.Write("<img src='images/wrong.gif' border='0'>") END IF %></td>
<td align="right" dir="rtl" class="titleEffects">
</tr>
<tr>
<td>
</td>
<td>
<input class="testFiled" class="Butto" type="submit" name="GO" value="Update" id="GO"> </td>
<td>
</td>
<td>
<input class="testFiled" name="reset" class="Butto" type="submit" value="Reset">
</td>
<td>
</td>
</tr>
</table>
<input type="hidden" name="OldName" value="<%=objOU.displayNam
<input type="hidden" name="OldOffice" value="<%=objOU.physicalDe
<input type="hidden" name="OldDept" value="<%=objOU.department
<input type="hidden" name="OldTitle" value="<%=objOU.Title%>">
<input type="hidden" name="OldExt" value="<%=objOU.telephoneN
<input type="hidden" name="" value="<%=objOU.telephoneN
</form>
<br>
</fieldset>
<br>
<%
IF rro <> "00000000000000" THEN
'response.Write(IsError(13
%>
<table width="90%" border="1" bordercolor="#1C4299">
<tr>
<td align="left" bordercolor="#FFFFFF" bgcolor="#FF0000" class="rror" width="50%">
<ol>
<% IF IsError(12) THEN %><li><font class="rror">User name cann't be empty</font></li> <% END IF%>
<% IF IsError(1) THEN %><li><font class="rror">User name can contain only characters,'.' and '-'</font></li><% END IF%>
<% IF IsError(2) THEN %><li><font class="rror">User name cann't be more than 30 characters</font></li><% END IF%>
<% IF IsError(8) THEN %><li><font class="rror">Office number has to be between 10 digits and 4 digits</font></li><% END IF%>
<% IF IsError(11) THEN %><li><font class="rror">Office number has to be digits only</font></li><% END IF%>
<% IF IsError(6) THEN %><li><font class="rror">Department name cann't be empty</font></li><% END IF%>
<% IF IsError(7) THEN %><li><font class="rror">Department name can contain only characters</font></li><% END IF%>
<% IF IsError(13) THEN %><li><font class="rror">The Title can contain only characters</font></li><% END IF%>
<% IF IsError(5) THEN %><li><font class="rror">Phone number can contain only digits</font></li><% END IF%>
<% IF IsError(3) THEN %><li><font class="rror">Phone number cann't be less than 4 digits </font></li><% END IF%>
<% IF IsError(4) THEN %><li><font class="rror">Phone number cann't be more than 10 digits</font></li><% END IF%>
<% IF IsError(9) THEN %><li><font class="rror">HR number is required if you Alrajhi Bank Employee</font></li><% END IF%>
<% IF IsError(10) THEN %><li><font class="rror">HR number has to be digits only</font></li><% END IF%>
</ol>
</td>
<td align="right" dir="rtl" bordercolor="#FFFFFF" bgcolor="#FF0000" class="rror" width="50%">
<ol>
<% IF IsError(12) THEN %><li><font class="rror">يج
<% IF IsError(1) THEN %><li><font class="rror">يم
<% IF IsError(2) THEN %><li><font class="rror">لا
<% IF IsError(8) THEN %><li><font class="rror">رق
<% IF IsError(11) THEN %><li><font class="rror">رق
<% IF IsError(6) THEN %><li><font class="rror">يج
<% IF IsError(7) THEN %><li><font class="rror">يج
<% IF IsError(13) THEN %><li><font class="rror">ال
<% IF IsError(5) THEN %><li><font class="rror">رق
<% IF IsError(3) THEN %><li><font class="rror">يج
<% IF IsError(4) THEN %><li><font class="rror">لا
<% IF IsError(9) THEN %><li><font class="rror">إذ
<% IF IsError(10) THEN %><li><font class="rror">ال
</ol>
</td>
<%
' 1."10000000000000" => not chars or . - in the name
' 2."01000000000000" => more than 30 chars in the name
' 3."00100000000000" => less than 4 digits in phone number
' 4."00010000000000" => more than 10 digits in phone number
' 5."00001000000000" => not digits in phone number
' 6."00000100000000" => No Dept name
' 7."00000010000000" => Only chars in Dept name
' 8."00000001000000" => no more 10 digits and less than 3 digits office
' 9."00000000100000" => You have to insert HR number
' 10."00000000010000" => Only digits in HR number
' 11."00000000001000" => only digits in Office number
' 12."00000000000100" => You have to fill your name
' 13."00000000000010" => Title contains only charchters
' 14."00000000000001" => ??
%>
</tr>
</table>
<%
END IF
%>
</div>
</body>
</html>
ASKER
CubeRoot
I tested your code in another page and it worked fine
I tested your code in another page and it worked fine
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.