Author Topic: Javascript for radiobutton  (Read 252 times)

Offline knip

  • Full Member
  • ***
  • Join Date: May 2011
  • Posts: 47
  • Forum Citizenship: +0/-2
Javascript for radiobutton
« on: 13 Mar 2018 09:10:28 pm »
Can someone help me with a javascript which automatically selects the first value of the radio button prompt?

Offline Pratap Reddy

  • Community Leader
  • *****
  • Join Date: Dec 2017
  • Posts: 105
  • Forum Citizenship: +0/-0
Re: Javascript for radiobutton
« Reply #1 on: 14 Mar 2018 02:02:33 am »
Hi,

You can use Default Selections in the Properties Pane of Radio Button Prompt.

Eg: 2010,2011,2012,2013 are there in Radio Button Prompt.

You can give 2010 in the Default Selections

Regards,
Pratap

Offline Pratap Reddy

  • Community Leader
  • *****
  • Join Date: Dec 2017
  • Posts: 105
  • Forum Citizenship: +0/-0
Re: Javascript for radiobutton
« Reply #2 on: 14 Mar 2018 02:22:11 am »
Can someone help me with a javascript which automatically selects the first value of the radio button prompt?

<form><div>
<input type="radio" name="Parameter1" 
name="Year" value="2010" checked>
</div>
</form>


Regards,
Pratap

Offline BigChris

  • Statesman
  • ******
  • Join Date: Apr 2013
  • Posts: 1,106
  • Forum Citizenship: +84/-0
Re: Javascript for radiobutton
« Reply #3 on: 14 Mar 2018 04:09:43 am »
But what would you need in a variable list of values? Say for example you were going to limit the radio button prompt to be the last ten years...how would you select the first value regardless of what year it was?

Offline Pratap Reddy

  • Community Leader
  • *****
  • Join Date: Dec 2017
  • Posts: 105
  • Forum Citizenship: +0/-0
Re: Javascript for radiobutton
« Reply #4 on: 14 Mar 2018 05:23:47 am »
Hi,

This have to work...

<script type = "text/javascript">
var fW =(typeof getFormWarpRequest == "function"? getFormWarpRequest() : document.forms["formWarpReguest"]);
if (fW)
{
if (fW._oLstChoicesMyList.length >= 1)
{
fW._oLstChoicesMyList.selectedIndex = 0;
}
}
</script>

Name the Miscellaneous to MyList.

Regards,
Pratap

 


       
Twittear