Click here to Skip to main content
15,504,703 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ,

C#
function validateRelationshipGender() {

        var gender, genderForm;
        gender = document.getElementById("NewUser:ContactPersonGender").value;
        genderForm = document.getElementById("NewUser:ContactPersonGender").disabled = true;
        if (gender == "Male" || gender == "Female") {

            genderForm = document.getElementById("NewUser:ContactPersonGender").disabled = false;

        }

    }
Posted
Comments
I.explore.code 15-Oct-12 5:15am    
do you want us to read the code and somehow read your mind as to what the problem could be? or would you be kind enough to tell whats the problem with the code?
AshishChaudha 15-Oct-12 5:21am    
and?? what the problem is??
sivis sans 15-Oct-12 5:22am    
actually i have two drop-down text boxes one is relationship(father,mother,son,daughter) and another one is gender(male ,female) , while i selecting relation ship father it automatically changed to male , and for mother as female (those process comes from bean) it will take 3 seconds , within 3 seconds i want disable and enable gender text box , using JS code using "onselect" event,

i tried but its not working , the above code is for disable and enable gender box but its not working for me , i m using JSF 1.0 version ,is this possible to do ?

I would recommend using jQuery, it makes JavaScipting easier to write and read:

To disable a control using jQuery use the attr() function passing in the attribute as the first parameter and value as the second.

JavaScript
$("#ddlc").attr("disabled", true);


where ddlc is the id of the control (which in my case is ASP.NET and in yours probably JSF):

ASP.NET
<asp:dropdownlist id="ddlc" runat="server" clientidmode="Static"></asp:dropdownlist>



For detailed jQuery documentation refer: jQuery[^]

Please let me know if this doesn't work for you and I will remove this solution.
 
Share this answer
 
v3
Comments
sivis sans 15-Oct-12 5:32am    
for jsf its very complicated to use , i will try my best .
$('#dropdown1').attr('disabled',true) for disable dropdown
$('#dropdown1').attr('disabled',false) for enable dropdown
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900