Fork me on GitHub

pnformradiobutton  Bottom

  • I really love the pnForm system and have started using it for all my new development. However, I have gotten stuck on a little issue with radio buttons and I am sure it's just a parameter I am not including. I want to be able to specify which radio button in a groups is check but can't seem to get the template right. Here is a simplified version of what I am putting in the form


    Code

    <p><!--[pnformradiobutton value="0" checked="1" groupName="quest_type" ]-->1</p>
    <p><!--[pnformradiobutton value="1" checked="0" groupName="quest_type" ]-->2</p>
    <p><!--[pnformradiobutton value="2" checked="0" groupName="quest_type" ]-->3</p>
    <p><!--[pnformradiobutton value="3" checked="0" groupName="quest_type" ]-->4</p>
    <p><!--[pnformradiobutton value="4" checked="0" groupName="quest_type" ]-->5</p>


    When I run this code, it renders correctly, and if I click on a button it works. However, on initial load, the first option is not selected. What parameter am I not including.



    edited by: Paustian, datetimebrief
  • After a bit more tinkering I figured it out. If you are not using the dataField, dataBased feature of pnformradiobutton, then you need to switch those off in your code, like this.

    Code

    <p><!--[pnformradiobutton value="0" checked="1" dataBased="0" groupName="quest_type" ]-->1</p>
    <p><!--[pnformradiobutton value="1" dataBased="0" groupName="quest_type" ]-->2</p>
    <p><!--[pnformradiobutton value="2" dataBased="0"  groupName="quest_type" ]-->3</p>
    <p><!--[pnformradiobutton value="3" dataBased="0"  groupName="quest_type" ]-->4</p>
    <p><!--[pnformradiobutton value="4" dataBased="0"  groupName="quest_type" ]-->5</p>


    It all works now.



    edited by: Paustian, datetimebrief

This list is based on users active over the last 60 minutes.