This topic is locked

How to disable/enable controls on Edit/Add pages, based on another con

7/16/2008 2:45:48 AM
ASPRunnerPro General questions
jfr author

Hi,
Following topic 6503 I want to disable one field on the form.
This is my code (at least the part which matters)

<TD class=borderedit

style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px">

<DIV class=xboxcontentb>

<TABLE cellSpacing=0 cellPadding=4 border=0>

<TBODY>

<TR>

<TD class=editshadeleft_b style="PADDING-LEFT: 15px"

width=263>Soort</TD>

<TD class=editshaderight_lb style="PADDING-LEFT: 10px"

width=842>{build_edit_control field="Soort_product" value=$value_Soort_product mode="edit"}

&nbsp;<IMG src="images/icon_required.gif"> </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px"

width=263>Productgroep</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px"

width=842>{build_edit_control field="Artikel_productgroep" value=$value_Artikel_productgroep mode="edit"}

&nbsp;<IMG src="images/icon_required.gif"> </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px"

width=263>Artikel</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px"

width=842>{build_edit_control field="Artikel" value=$value_Artikel mode="edit"} &nbsp;<IMG

src="images/icon_required.gif"> </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px"

width=263>Omschrijving</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px"

width=842>{build_edit_control field="Artikel_omschrijving" value=$value_Artikel_omschrijving mode="edit"}

</TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px"

width=263>Bruto prijs</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px"

width=842>{build_edit_control field="Bruto_prijs" value=$value_Bruto_prijs mode="edit"} </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px"

width=263>Aantal</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px"

width=842>{build_edit_control field="Aantal" value=$value_Aantal mode="edit"} &nbsp;<IMG

src="images/icon_required.gif"> </TD></TR>

<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px"

width=263>Korting</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px"

width=842>{build_edit_control field="Korting" value=$value_Korting mode="edit"} </TD></TR>

<TR>

<TD class=downedit align=left width=1105 colSpan=2><IMG

src="images/icon_required.gif"> - Verplicht veld </TD></TR>

<TR>

<TD class=downedit align=middle width=1105 colSpan=2><SPAN

class=buttonborder><INPUT class=button type=submit value=&nbsp;&nbsp;Opslaan&nbsp;&nbsp; name=submit1></SPAN>

<SPAN class=buttonborder><INPUT class=button type=reset value=&nbsp;&nbsp;Herstel&nbsp;&nbsp;></SPAN>

<SPAN class=buttonborder><INPUT class=button onclick="window.location.href='Order_regel_list.asp?a=return'" type=button value="&nbsp;&nbsp;Terug naar lijst&nbsp;&nbsp;"></SPAN>

<input type=hidden name="a" value="edited"></TD></TR></FORM></TBODY></TABLE></DIV><B

class=xbottom><B class=xb4a></B><B class=xb3a></B><B

class=xb2a></B><B class=xb1a></B></B></TD></TR></TBODY></TABLE></DIV><B

class=xbottom><B class=xb4b4></B><B class=xb3b4></B><B class=xb2b4></B><B

class=xb1b4></B></B></TD></TR></TBODY></TABLE><BR>{include_if_exists file="include/footer.asp"} {$linkdata}<script>SetToFirstControl();</script></BODY></HTML>

<script>

document.forms.editform.value_Soort_product.onchange=function()

{

if(this.options[this.selectedIndex].value=='Dienst')

document.forms.editform.value_Korting.disabled=false;

else

{

document.forms.editform.value_korting.disabled=true;

document.forms.editform.value_Korting.value='';

}

}

</script>


And this is a printscreen of the form.


What I want to do is Disable the field Korting, if Soort is Dienst.

With the code above, it simply disables the field after Dienst for doing its normal job.
Any tips are welcome.
Thanks a million,
John

J
Jane 7/17/2008

John,
your code looks corrects.

Please clarify what you want to achieve.

jfr author 7/17/2008

Hi Jane,
What I am trying to do is;
Disable the Field Korting (last one) when Soort = Dienst (first one)
Sorry for the Dutch <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=31155&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
John

J
Jane 7/17/2008

John,
your code should work.

Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with your instructions.

I'll find what's wrong with your project inspecting it at Demo account site.