ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old September 8th, 2004, 12:58 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
Question not allowing users to edit every textfield

hi,
i have a form that will be passed in between different people. my problem is everyone is supposed to edit only their section, not anybody else's.
here is what i have done so far.

<cfset AreaToEdit = "EngineeringArea">
....
<script language="JavaScript" type="text/JavaScript">
function valUserRole(area)
{
if (area != <cfoutput>#AreaToEdit#</cfoutput>)
{ alert ("You are not authorized to edit the " + area + " !"); }
sendUser(<cfoutput>#AreaToEdit#</cfoutput>);
}

function sendUser(kE)
{
document.form1.kE.focus();
}
</script>
....

<body onLoad="sendUser(<cfoutput>#AreaToEdit#</cfoutput>)">
<form name="form1" method="post" action="">
<p>
<textarea name="salesarea" onClick="ValUserRole('salesarea')"></textarea>
sales area</p>
<p>
<textarea name="businessarea" onClick="ValUserRole('businessarea')"></textarea>
business area</p>
<p>
<textarea name="engineeringarea" onClick="ValUserRole('EngineeringArea')"></textarea>
engineering area </p>
</form>

but the script doesn't work. i can edit any field
what am i doing wrong? thanks for the help in advance...

Reply With Quote
  #2  
Old September 8th, 2004, 01:14 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
You can't rely on Javascript to enforce this anyway, because a user can just disable Javascript in their browser and then edit anything they want. A better approach would be to decide on the server what the user has access to edit and only send that to the user. If the user needs to see the other information (that they can't edit), the other fields could be just text instead of form fields.

The real lesson is that NO security can be enforced client side, everything must be enforced on the server side. Client side is just to make things easier on the user, but you still must always enforce this type of behavior on the server.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old September 8th, 2004, 01:31 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
kiteless,

i appreciate your input but this form will be used among 7 managers and will be posted on the intranet. so, security is not a concern for this specific application. the originator will be able to edit any field any time.

Reply With Quote
  #4  
Old September 8th, 2004, 06:42 PM
spicy spicy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Gold Coast, Australia
Posts: 77 spicy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 32 m 53 sec
Reputation Power: 5
I am not an experienced cf user, but I have done something similar to one of my clients site using nothing else but cf login and cf if statements. It may not be the best way, but it works.

Especially with cf mx you can find out who is loged in easily, and then just run a if statement around every text box, i.e.

<cfif IsDefined("user") AND #user# IS user_allowed">
enable text box code
<cfelse>
disable text box
</cfif>

I am not exactly clear what the method was to enable and disable the text boxes, but I do remember seeing it quite a lot. As I said, I am not that good, and heavily rely on Ben Fortes book.

Regards Joe

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > not allowing users to edit every textfield


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway