because im using session variables i need to be able to reset input values to "" and keep values in input if submit is clicked
basically i need java script that will keep the users input values instead of deleting on submit
was trying for
function check()
{
document.frmJoinUs.lastname.value = <%=Session("LastName")%>
} but this didnt work
Originally posted by Consuelo heres the link but i think it will time out - probably cant be seen outside of the university..
what about my code - can i post that?
Apparently, I cannot view the link "outside of the university." So, yes, please post your code.
[J]ona
Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.
i got rid of the "=" in last name so the reset button would work but now if the user clicks submit the values also dissapear thats why im trying to use javascript to redisplay the users input after the submit
<%@ language=VBScript %>
<%
option explicit
Response.Buffer = true
Response.Expires = 0
'on error resume next
'------------------------------------------------------------------------------
' file name JoinUs.asp
' Description :
' History:
' 2001-02-01 - HShi - created
'------------------------------------------------------------------------------
%>
<!--#INCLUDE FILE="../lib/ut_utility.asp"-->
<!--#INCLUDE FILE="./addDataToFile.inc"-->
<%
Dim f1
Dim strCheck1,strCheck2,strCheck3,strCheck4, strCheck, strReSelect
Dim strMessage
Call Initialisation
Const HTML_TEXTAREA_SIZE_LIMIT = 250
If UCase(trim(Request.Form("cmdSubmit"))) = "SUBMIT NOW" Then
Call AddFormData
'Do user input and business rule validation
If IsValidForm = False Then
strMessage = "<font color='#ff0000'><BR><b>Please review the following details before re-submitting the application form</b>." & _
strMessage & "<br></font>"
Else
addToTable()
strMessage = "<font color='GREEN'><b>Thank you for your application. You will receive a confirmation email.</b></font><BR><BR>"
strMessage = strMessage
%>
<!--#INCLUDE FILE="./createnewfile.inc"-->
<%
Dim fso,fn
Dim strFileName
'Session("UserName") = ""
'Session("password") = ""
'Session("password2") = ""
End If
%>
You can choose your favorite background color:<BR>
<BUTTON onClick="document.bgColor='white'"> WHITE </BUTTON>
<BUTTON onClick="document.bgColor='red'"> RED </BUTTON>
<BUTTON onClick="document.bgColor='green'"> GREEN </BUTTON>
<BUTTON onClick="document.bgColor='blue'"> BLUE </BUTTON>
<BUTTON onClick="document.bgColor='yellow'"> YELLOW </BUTTON>
<BUTTON onClick="var bg = prompt('Please enter your favorite color' , 'custom');document.bgColor=bg"> CUSTOM </BUTTON>
<BR>
<form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>"
name="frmJoinUs" onSubmit="return confirmSubmit();">
<TABLE>
<TR align = "LEFT"><B>Fields marked with "<FONT color='#ff0000'>*</FONT>" are compulsory<B><TR>
<TR>
<TD align="RIGHT">First Name:<FONT color='#ff0000'>*</FONT>
</TD>
<TD>
<INPUT type="TEXT" name="firstname" size="20" MaxLength="20" value="<%=Session("FirstName")%>">
Last Name:<FONT color='#ff0000'>*</FONT>
<INPUT type="TEXT" name="lastname" size="20" MaxLength="20" value="<%Session("LastName")%>">
</TD>
</TR>
<TR>
<TD align="RIGHT">
Phone:<FONT color='#ff0000'>*</FONT>
</TD>
<TD colspan = "2">
<INPUT type="TEXT" name="phone" size="15" MaxLength="10" value="<%Session("Phone")%>" ID="Text1">
Fax:<INPUT type="TEXT" name="fax" size="15" MaxLength="10" value="<%Session("Fax")%>">
Mobile:<INPUT type="TEXT" name="mobile" size="15" MaxLength="10" value="<%Session("Mobile")%>">
</TD>
</TR>
<TR>
<TD align="RIGHT">E-Mail address:<FONT color='#ff0000'>*</FONT></TD>
<TD colspan = "2"><INPUT type="TEXT" name="email" size="30" MaxLength=30 value="<%Session("Email")%>"><TD>
</TR>
<%
strReSelect = Session("Gender")
If not len(trim(strReSelect)) > 0 then
strReSelect = ""
end If
%>
<TR>
<TD align="RIGHT">Gender:</TD>
<TD><INPUT type="RADIO" name="gender" value="Male"<%'ut_Checked("Male", strReSelect)%>>Male
<INPUT type="RADIO" name="gender" value="Female"<%'ut_Checked("Female", strReSelect)%>>Female</TD>
</TR>
<TR>
<TD align="RIGHT">Hobbies:</TD><TD>
<%
strCheck1 = Session("hobby1")
If not len(trim(strCheck1)) > 0 then
strCheck1 = ""
end If
strCheck2 = Session("hobby2")
If not len(trim(strCheck2)) > 0 then
strCheck2 = ""
end If
strCheck3 = Session("hobby3")
If not len(trim(strCheck3)) > 0 then
strCheck3 = ""
end If
strCheck4 = Session("hobby4")
If not len(trim(strCheck4)) > 0 then
strCheck4 = ""
end If
%>
<INPUT type=CHECKBOX name="hobby1" value="Basketball" <%'ut_checked("Basketball", strCheck1)%>> Basketball
<%
strReSelect = Session("Occupation")
If not len(trim(strReSelect)) > 0 then
strReSelect = ""
end If
%>
<TR>
<TD align="RIGHT">Occupation:</TD>
<TD><SELECT name="Occupation">
<OPTION value="" <%'ut_Selected("", strReSelect)%>>[SELECT occupation]
<OPTION value="Executive" <%'ut_Selected("Executive", strReSelect)%>>Executive
<OPTION value="Professional" <%'ut_Selected("Professional", strReSelect)%>>Professional
<OPTION value="Academic" <%'ut_Selected("Academic", strReSelect)%>>Academic
<OPTION value="Technician" <%'ut_Selected("Technician", strReSelect)%>>Technician
<OPTION value="Other" <%'ut_Selected("Other", strReSelect)%> >Other
</SELECT>
</TD>
</TR>
<TR>
<TD align="RIGHT">Message (No more than 200 characters):</TD>
<TD><TEXTAREA name="message" cols="30" rows="4" ><%Session("message")%></TEXTAREA><TD>
</TR>
Bookmarks