This topic is locked

Toggle Checkboxes on Edit?

3/9/2007 12:28:04 PM
ASPRunnerPro General questions
V
VORONOY author

Is it passable to do "toggle" of checkboxes to follow some logic and disable/enable group of them on edit page??? I think it should be simple on ADD page, but I want to be able to see it on EDIT page with returned values.
Any directions, that I should go? I know how to do toggle in HTML using javascript. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=4784&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />
Thank you.

Sergey Kornilov admin 3/9/2007

This logic can be implemented as a javascript code.

I don't see the difference between Add and Edit in this regard.

V
VORONOY author 3/9/2007

Privet Sergey!
So, where should I put a javascript? In VisualEditor or modify Template_edit.htm directly? I tried to modify template file and it is kind of working - adding new data, but not returning fields data back. Also I can not use Time field with calendar. It just not populating on Date to the field.
Here is my sample code:
[codebox]

&lt;script language="JavaScript">

<!--

var locale_dateformat = 0;var locale_datedelimiter = "/";var bLoading=false;var TEXT_PLEASE_SELECT='Please select';
function MM_findObj(n, d) {

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

if(!x && d.getElementById) x=d.getElementById(n); return x;

}
function flvFTFO1(){

if (!document.layers){var v1=arguments,v2=MM_findObj(v1[0]),v3,v4,v5,v6,v7,v8,v9,v10,v11,v12;if (v2){for (v3=1;v3<v1.length;v3++){v6=v1[v3].split(",");v7=v6[0];v8=v6[1];v11=false;v5=eval("document."+v1[0]+"."+v7);v10=(!v5)?false :true;if (!v10){v5=MM_findObj(v7);v10=(!v5)?false :true;}else {v11=(!v5.type)?true :false;}if (v10){if (v8=="t"){if (!v11){v5.disabled=!v5.disabled;}else {for (v12=0;v12<v5.length;v12++){v5[v12].disabled=!v5[v12].disabled;}}}else {v9=(v8=="e")?false :true;if (!v11){v5.disabled=v9;}else {for (var v12=0;v12<v5.length;v12++){v5[v12].disabled=v9;}}}}}}}}
</script>

&lt;script language="JavaScript" src="include/calendar.js"></script>

<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>

<BODY bgColor=white onload="define('value_slide_date','IsRequired','Receipt of Form Date');">

<FORM name=editform action=Action_edit.asp method=post

encType=multipart/form-data onSubmit="return validate();">

<p>ACTION

<input name="radiobutton1" type="radio" onClick="flvFTFO1('editform','checkbox2,e','radiobutton1,t','radiobutton2,e','submit1,e','value_Close_date,e')" value="YES">

YES

<input name="radiobutton2" type="radio" onClick="flvFTFO1('editform','checkbox2,d','radiobutton1,e','radiobutton2,t','submit1,d','value_Close_date,d')" value="NO">

NO




<input name="value_Close_date" type="Text" disabled="disabled"

onblur="var dt=parse_datetime(this.value,0);if(dt!=null) editform.tsvalue_Close_date.value=print_datetime(dt,-1,false);else editform.tsvalue_Close_date.value=''" value="" size = "20">

<input type="Hidden" name="tsvalue_Close_date" value="0-0-0">

<a href="#" onclick="java script:var v=show_calendar('updatevalue_Close_date', document.editform.tsvalue_Close_date.value,false,true); return false"><img src="images/cal.gif" width=16 height=16 border=0 alt="Click Here to Pick up the date"></a>
&lt;script language=JavaScript>

function updatevalue_Close_date(newDate){document.forms.editform.value_Close_date.value = print_datetime(newDate,0,false);document.forms.editform.tsvalue_Close_date.value = print_datetime(newDate,-1,false); }

</script>
<INPUT type="hidden" name="type_Close_date" value="date11">

</p>

<p>

<input name="checkbox2" type="checkbox" disabled="disabled" value="checkbox">



<INPUT class=button id=submit1 type=submit value=Save name=submit1>

<INPUT class=button type=reset value=Reset>

<input type=hidden name="a" value="edited">

</p>

</FORM> [/codebox]
Thanks!