1

I have event in submit button as below in SharePoint 2010. How to insert more jsCript condition Radio button checked in which line to hide button when condition True?

Thank you in advance.

<input type="button" value="Submit" name="btnFormAction" onclick="javascript: {ddwrt:GenFireServerEvent('__commit')}; window.alert('Successfully'); window.open('', '_self', ''); window.close();" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; width: 155px; height: 22px" />
1

The following java script code in your desire page to hide the field

<input type="radio" name="Internal Person" id="Person Type" value="ctl001">Internal Person</input>

The above code displays radio button. Now you want to hide

var newVal = $(':radio[name=Reported By]:checked').val();
if (newVal == "ctl001") 
{
   $('nobr:contains("Internal Reporter Name")').closest('tr').show();
}
else
{
   $('nobr:contains("Internal Reporter Name")').closest('tr').hide();
}

OR Else Try This Code

<input name="yesno" id="yesno_yes" type="radio" value="Yes" onclick="toggleText()">
<input name="yesno" id="yesno_no" type="radio" value="No" onclick="toggleText()">
<input type="text" id="textID" />

Add the JavaScript:

function readValue (radioName)
{
 for (var i = 0; i < document.getElementsByName(radioName).length; i++)
  {
    if (document.getElementsByName(radioName)[i].checked)
    {
         return document.getElementsByName(radioName)[i].value;
    }
  }
}

function toggleText()
{
  var val=readValue("yesno");
  var txtBox=document.getElementById("textID");
  if(val==="Yes")
  {
    txtBox.style.display='block';
  }
  else
  {
    txtBox.style.display='none';
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.