FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Radio displaying checked rather than showing radio selected state?
#1
Hello,

New to Form Tools and working through tuts for a questionnaire. All is good appart from: if the form fails validation the word "checked" is displayed next to the selected radio button instead of showing a selected radio button?

This an extract from the code:

td>It was easy to contact my local depot</td>
<td align="center"><input name="q2a" type="radio" value="6"><?php if (@$fields["q2a"] == "6") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="5"><?php if (@$fields["q2a"] == "5") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="4"><?php if (@$fields["q2a"] == "4") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="3"><?php if (@$fields["q2a"] == "3") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="2"><?php if (@$fields["q2a"] == "2") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="1"><?php if (@$fields["q2a"] == "1") echo "checked"; ?></td>

My form action is:

<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">

Params:

<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">

Demo url http://bit.ly/MVpwjt
Reply
#2
(Jun 28th, 2012, 4:42 AM)Kev Wrote: Hello,

New to Form Tools and working through tuts for a questionnaire. All is good appart from: if the form fails validation the word "checked" is displayed next to the selected radio button instead of showing a selected radio button?

This an extract from the code:

td>It was easy to contact my local depot</td>
<td align="center"><input name="q2a" type="radio" value="6"><?php if (@$fields["q2a"] == "6") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="5"><?php if (@$fields["q2a"] == "5") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="4"><?php if (@$fields["q2a"] == "4") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="3"><?php if (@$fields["q2a"] == "3") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="2"><?php if (@$fields["q2a"] == "2") echo "checked"; ?></td>
<td align="center"><input name="q2a" type="radio" value="1"><?php if (@$fields["q2a"] == "1") echo "checked"; ?></td>

My form action is:

<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">

Params:

<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">

Demo url http://bit.ly/MVpwjt


OK Found it..

I needed to remove the closing > after value:

<td align="center"><input name="q2a" type="radio" value="6"><?php if (@$fields["q2a"] == "6") echo "checked"; ?></td>

And pace it at the end:
td align="center"><input name="q2a" type="radio" value="6" <?php if (@$fields["q2a"] == "6") echo "checked"; ?> /></td>

Problem solved..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)