mljonzs
Posts: 124
|
| Posted: 06/15/2006, 12:45 PM |
|
I've been searching through older posts and KB entries, but nothing is working and/or making sense.
I am trying to dynamically display a field as editable or readonly based on an application cookie value but I can't seem to get it to work. I've read some articles for mainpulating the HTMLTemplate but it isn't working for me and it is driving me batty!
I'm using ASP with CCS 3.0.4.6
Can anyone help me out?
Thanks!
_________________
What does not begin WITH God, will end in failure!
|
 |
 |
mljonzs
Posts: 124
|
| Posted: 06/15/2006, 1:12 PM |
|
It figures that right after I post my question a light comes on upstairs!
I was able to get this working once I understood what all the previous posts and articles were telling me to do.
For anyone interested:
The HTML for my control was changed to look like:
<input maxlength="15" size="15" value="{Option_Price}" name="{Option_Price_Name}" {lblReadOnly}>
Then in the BeforeShow Event I added the following code to set the {lblReadOnly} value:
if trim(UserType) <> "Admin" Then
HTMLTemplate.SetVar "@lblReadOnly", "readonly"
else
HTMLTemplate.SetVar "@lblReadOnly", ""
end if
_________________
What does not begin WITH God, will end in failure!
|
 |
 |
Benjamin Krajmalnik
|
| Posted: 06/15/2006, 7:47 PM |
|
Alternatively, you can do it client side with javascript.
"mljonzs" <mljonzs@forum.codecharge> wrote in message
news:64491bf15e6c67@news.codecharge.com...
> It figures that right after I post my question a light comes on upstairs!
> 
>
>
> I was able to get this working once I understood what all the previous
> posts
> and articles were telling me to do.
>
> For anyone interested:
>
> The HTML for my control was changed to look like:
> <input maxlength="15" size="15" value="{Option_Price}"
> name="{Option_Price_Name}" {lblReadOnly}>
>
> Then in the BeforeShow Event I added the following code to set the
> {lblReadOnly} value:
> if trim(UserType) <> "Admin" Then
> HTMLTemplate.SetVar "@lblReadOnly", "readonly"
> else
> HTMLTemplate.SetVar "@lblReadOnly", ""
> end if
>
> _________________
> Happy coding!
> mljonzs
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
mljonzs
Posts: 124
|
| Posted: 06/16/2006, 6:29 AM |
|
Quote :Alternatively, you can do it client side with javascript.
Being rather weak in javascript still - how would you do this? Can you give an example?
Thanks!
_________________
What does not begin WITH God, will end in failure!
|
 |
 |
grivers
|
| Posted: 06/29/2006, 3:39 AM |
|
Don't know if this helps but I found this code worked well.
NOTES:
1) You have to name your forms in the html
2) you have to name the text areas in the html
3) In the doit method, you use the Document object Model to navigate to your text area.
<html>
<SCRIPT language="JavaScript">
<!--hide
function doit()
{
document.form2.theTextarea.readOnly=false;
if ( document.form2.theTextarea.value.length > 0 ) {
document.form2.theTextarea.readOnly=true;
}
}
-->
</SCRIPT>
<body onLoad="doit()">
<FORM NAME="form2">
<TEXTAREA NAME="theTextarea" ROWS="10" COLS="60">
</TEXTAREA>
</FORM>
</body>
</html>
|
|
|
 |
|