Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't let user edit form field but still send field data on submit.

Status
Not open for further replies.
Jan 8, 2001
163
US

Hi there. I have a form which lists a bunch of user data. The username and userid need to appear but must not be altered by the user. All of the other data in the form is editable. All of the fields are then supposed to be sent to the next UpdateUser.jsp page. Unfortunately, the username and userid don't appear in the URL as they should. My bean sets and gets them as required. The "ed_userid=3&ed_username=SAL" don't appear in the URL while all of the other variables do. Does setting "DISABLED = TRUE" mean that the user can't access that text box AND that the data isn't sent in the form? My code is below. Does anyone have any advice on what I can do?

Thanks is advance,
CrystalVisualBOracle :)


...
String s_uname = "";
String i_userid = "";
String s_fname = "";
String s_intl = "";
String s_lname = "";
String s_expired = "";
String s_started = "";
String i_compid = "";
%>
<% s_uname = ueb.getuname();
i_userid = ueb.getuserid();
s_fname = ueb.getu_fname();
s_intl = ueb.getu_in();
s_lname = ueb.getu_lname();
s_expired = ueb.getu_expired();
s_started = ueb.getu_started();
i_compid = ueb.geti_compid();
%>

<HTML>
<BODY>
<FONT FACE=&quot;Arial&quot;>
<H1 ALIGN= &quot;CENTER&quot;>UPDATE USER INFORMATION</H1>
<FONT SIZE=2>

<FORM ACTION=&quot;UpdateUser.jsp&quot;
<CENTER>
<TABLE BORDER = 4 align = CENTER cellpadding=2 width=&quot;95%&quot; BGCOLOR =&quot;#FFCC00&quot;>

<TR valign=&quot;top&quot;>
<TD><font face=&quot;Arial, helvetica&quot; size=-2 >USERNAME:
<INPUT TYPE = &quot;TEXT&quot; NAME=&quot;ed_username&quot; VALUE=&quot;<%= s_uname %>&quot; size=&quot;20&quot; maxlength=&quot;50&quot; DISABLED = True> </TD>

<TD> <font face=&quot;Arial, helvetica&quot; size=-2 >USERID:
<INPUT TYPE = &quot;TEXT&quot; NAME=&quot;ed_userid&quot; VALUE=&quot;<%= i_userid %>&quot; size=&quot;7&quot; maxlength=&quot;30&quot; DISABLED = True> </TD>


<TD><font face=&quot;Arial, helvetica&quot; size=-2>PASSWORD:
<INPUT TYPE = &quot;TEXT&quot; NAME=&quot;ed_password&quot; size=&quot;8&quot; maxlength=&quot;8&quot;> </TD>
</TR>

<TR valign=&quot;top&quot;>
<TD><font face=&quot;Arial, helvetica&quot; size=-2>FIRSTNAME:
<INPUT TYPE = &quot;TEXT&quot; NAME=&quot;ed_firstname&quot; VALUE=&quot;<%=s_fname%>&quot;><BR> </TD>

<TD><font face=&quot;Arial, helvetica&quot; size=-2>LASTNAME:
<INPUT TYPE = &quot;TEXT&quot; NAME=&quot;ed_lastname&quot; VALUE=&quot;<%= s_lname %>&quot;><BR> </TD>
</TR>
</TABLE><BR>
<CENTER><INPUT TYPE = &quot;RESET&quot; VALUE = &quot;REFRESH&quot;>
<INPUT TYPE=&quot;SUBMIT&quot; VALUE=&quot;UPDATE&quot;>
</FORM>
</BODY>
</HTML>



 
Don't place the Username and Userid in a textbox on edit. Instead place them in hidden html fields and print out the information as plain html. Example:
Code:
<TD><font face=&quot;Arial, helvetica&quot; size=-2 >
  USERNAME: <%= s_uname %>    
  <INPUT TYPE=&quot;hidden&quot; NAME=&quot;ed_username&quot; VALUE=&quot;<%= s_uname %>&quot;>   
</TD>
<TD><font face=&quot;Arial, helvetica&quot; size=-2 >
  USERID: <%= i_userid %>
  <INPUT TYPE=&quot;hidden&quot; NAME=&quot;ed_userid&quot; VALUE=&quot;<%= i_userid %>&quot;>   
</TD>
Solves the problem, looks better, and it doesn't mislead the user. Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top