This topic is locked

Hide some parts from page depoend on Select Box Value.

2/23/2008 1:37:26 AM
ASPRunnerPro General questions
H
hussainz2000 author

Dear All,

I have created a form with select box field.

but how can i control form depend on select box value?
For example:

Select Box with two values : (Value 1 and Value 2).

and in the form(web page) there are two parts : (Part 1 and part2).

if i select Value 1 ,part1 appearing and Part 2 hiding.

And if i select Value 2 ,part2 appearing and Part 1 hiding.
Regards,

H
hussainz2000 author 2/24/2008

No Response ???

J
Jane 2/26/2008

Hi,
you can do it using JavaScript code on the Visual Editor tab.

Here is a sample:

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

{

if (document.forms.editform.value_FieldName.value=="Value1")

getElementById("part1").style.display='none';

}


Then put your code for part 1 into the DIV with id="part1".

H
hussainz2000 author 2/27/2008

Thank you.

i will try and tell you about it.

Thanks again and regards

M
MaxxaM 4/21/2009

I tried your example and nothing is happening...I'm assuming it's simply my lack of knowledge or a syntax problem here...
Section I want to be not visable when 'Cluster' is selected from dropdown...
<DIV id="part1">

{BEGIN numComputers_fieldblock}<TR>

<TD class=editshade_b style="PADDING-LEFT: 15px" width=219>Number

of&nbsp;Computers</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px" width=289>{$numComputers_editcontrol} </TD>

<TD width=605>&nbsp;&lt; 16 (N/A Cluster Use)</TD></TR>

{END numComputers_fieldblock}

</DIV>
bottom of page to handle the onchange event of the dropdown...
<script>

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

{

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

getElementById("part1").style.display='none'

,document.forms.editform.value_durationComputer.disabled=true

;

else

{

document.forms.editform.value_durationComputer.disabled=false

;

}

}

</SCRIPT>
Any help would be greatly appreciated! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=40356&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

J
Jane 4/22/2009

Hi,
I recommend you to publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.