Forums

Wrong security image code resets form

jphillips 26 May, 2007
If a wrong security image code is typed in and the user submits, all form fields are reset (cleared) and the user is forced to re-input everything again. Is it possible for the logic to check the security image code without clearing the form when it's wrong?
Max_admin 31 May, 2007
Hmmmm, I will try to implement this in the next release🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 11 Jun, 2007
Hi,

Browsing through old posts looking for something else I stumbled across this one.

I have this working OK. You need to set values for the form fields like value="<?php echo $_POST['thisfieldname'] ?> - these will be null when the form first displays.

Then look for the error check in chronocontact.php after if ( !$checkSecurity ) { and replace exit; with showform();

This isn't perfect. I've hacked mine a little more to show the error message through showform($error) and to suppress the sending of e-mail messages, onSubmit code etc.

Bob
webx 13 Jun, 2007
The problem is actually with the security images themselves. I have on several occasions typed in the correct security image and it flops. I actually took it out because after filling out the form I have in place just twice, and having to start over because of this problem, it was apparent that my users would not appreciate being run through the ringer twice.
GreyHead 13 Jun, 2007
Hi webx,

I haven't experienced a failed code - I just couldn't read some of them. I hacked my version of ChronoForms to use the SecurityImages extension, and to retain and re-display the form data if there is an image verification failure.

Bob
Max_admin 13 Jun, 2007
A new better verification images will be in V 2.1 soon!!

Thanks

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jazz 18 Oct, 2007
Hi i was wondering howz the image verification goin...

We started gettin spam, and hence i enabled the image verification, but if the users enters wrong image code, the entire form resets.

Is there any solution to this problem as of yet ?

Thank you,
Jazz
GreyHead 19 Oct, 2007
Hi Jazz,

The more recent versions of ChronoForms will re-show the form with the data but I think you you have to set your form fields up wth values from $_POST e.g. name="myfield" value="$_POST['myfield']" (I'm not certain about this as Max has changed the code recently).

Bob
Max_admin 19 Oct, 2007
Hi Jazz,

Exactly as Bob's suggested, you will need to put this code inside of every input value attribute :

<?php echo $_POST['field_name']; ?>


This will work for all field types except dropdowns, radios and checkboxes!!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
andrew222 23 Oct, 2007
Hi,

I can't seem to grasp where to put the

<?php echo $_POST['field_name']; ?>

The first set of code I have on my 2.3.5 form is

fieldset>
<legend><strong>Your Details</strong></legend>
<p><label1 for="name">Your Name:</label1><input type="text" name="name" size="40"></p>
<p><label1 for="email">E-mail:</label1><input name="email" type="text" size="40">
<p><label1 for="dayphone">Day Phone:</label1><input type="text" name="day_phone" size="20">         </p>
<p><label1 for="evephone">Evening Phone:</label1><input type="text" name="night_phone" size="20"></p>
</p>
</fieldset>

so where would I add it to keep the form data from being lost on a page refresh or a wrong code?

Thanks

Andrew
Max_admin 23 Oct, 2007
Hi Andrew,

this line :

<input type="text" name="name" size="40">


should be :

<input type="text" name="name" size="40" value="<?php echo $_POST['name']; ?>">
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
andrew222 23 Oct, 2007
Ahhhhhhh!

Thanks for that. Got the form working now :woohoo:

All the best

Andrew
Max_admin 24 Oct, 2007
Great, thanks Andrew!!🙂

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
filipetorres 24 Oct, 2007

Hi Jazz,
Exactly as Bob's suggested, you will need to put this code inside of every input value attribute :

<?php echo $_POST['field_name']; ?>

This will work for all field types except dropdowns, radios and checkboxes!!

Cheers
Max



Hi max,
my form have various dropdowns (17 fields) and checkboxes (23 fields). Reselect 40 fields again will cause irritation in my site users. Already workaround exist?
Max_admin 24 Oct, 2007
Hi filip,

for checkboxes or radios you will have to edit it to be :

<input type="checkbox" <?php if($_POST['fieldname'])echo 'checked'; ?>


for drops, every option tag must have this PHP piece :

<?php if($_POST['fieldname'] == 'this_option_value') echo 'selected'; ?>


I think there should be a better way for teh drops with some JS function but cant think about it now coz iam in rush🙂

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
sinclair 26 Oct, 2007
Hi Max

I tried to use the code for "drops" but I didn't get it working. Can you please give me an example how to insert the code in the following example:

<select name="month" >
<option value=""> 
<option value="January">January 
<option value="February">February 
....
....
</select>


Is there a code that can be used for "textarea" as well to keep the data?

Thanks for your help.
Sinclair<br><br>Post edited by: admin, at: 2007/10/26 11:58
Max_admin 26 Oct, 2007
Hi Sinclair,

For textareas, you just use the normal code I posted earlier :

<textarea><?php echo $_POST['field_name']; ?><textarea>


For drops, here is your example :


<select name="month" >
<option value=""> 
<option <?php if($_POST['month'] == 'January') echo 'selected'; ?> value="January">January 
<option <?php if($_POST['month'] == 'February') echo 'selected'; ?> value="February">February 
....
....
</select>
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
sinclair 26 Oct, 2007
Hi there,

Thanks a lot for your help. I appreciate your quick reply.
All works fine now!

:)
bhyland 17 Nov, 2007
Hi,

Hoping someone can put me on the right track, I've tried the above code on radio buttons and I'm getting no joy as it seems to reload based on the order of the code i.e. if the "no" radio button is last in the order of the code that is what gets posted after verification fails? I know it's me as I'm not a coder but can some one give me a code example for a yes / no radio button group...

Thanks
GreyHead 17 Nov, 2007
Hi bhyland,

It will be similar but using the radio button syntax. Like this I think:
<input type ="radio" name="radio_1" value = "Yes" <?php if($_POST['radio_1'] == 'Yes') echo 'check="checked"'; ?> />Yes </br>
<input type ="radio" name="radio_1" value = "No" <?php if($_POST['radio_1'] == 'No') echo 'check="checked"'; ?> /> No </br>
Bob<br><br>Post edited by: GreyHead, at: 2007/11/18 00:20
bhyland 18 Nov, 2007
Hi Bob,

Thanks for the response, I cut and pasted the code into a form and add the {verification} and submit button but it is not posting any value into the radio button after verification fails? any ideas?

Thanks again

Brian
GreyHead 18 Nov, 2007
Hi Brian,

I think I added some [] to the code that don't belong, I've removed them from my post.

Would you like to post your current form html - at least the radio button piece - here so I can test that?

Bob
bhyland 18 Nov, 2007
Hi Bob,

Here's what I have been using to test the buttons, unfortunately the code still is having problems in that is doesn't post the "value" when I get the verififcation wrong.. it comes back blank.

<input type ="radio" name="radio_1" value = "Yes" <?php if($_POST['radio_1'] == 'Yes') echo 'check="checked"'; ?> />Yes </br>
<input type ="radio" name="radio_1" value = "No" <?php if($_POST['radio_1'] == 'No') echo 'check="
checked"'; ?> /> No </br>
<table>
		<tr>
      <td width="286">Additional Comments </td>
      <td colspan="2"><textarea name="comments" cols="30" rows="6" id="comments"></textarea></td>
    </tr>
<tr>
    <td>Please enter verification code</td>
      <td>{imageverification}</td>
      </tr>
		<tr>
      <td><input type="submit" name="Submit" value="Submit" />
      <input name="Reset" type="reset" id="Reset" value="Reset" /></td>
		</tr>
</table>


Hope you can fathom this🙂 thanks again for the support!

Brian
Max_admin 20 Nov, 2007
Hi Brian,

plz try this code :


<input type ="radio" name="radio_1" value = "Yes" <?php if($_POST['radio_1'] == 'Yes') echo '"checked"'; ?> />Yes </br>
<input type ="radio" name="radio_1" value = "No" <?php if($_POST['radio_1'] == 'No') echo '"
checked"'; ?> /> No </br>
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
bhyland 20 Nov, 2007
Hi,

Thanks for the suggestion, sadly this is still not working. I cut & pasted the code snippet into a test form and I have not made any "code" changes to the component, it's a clean install of 2.3.6.

I appreciate any help you can provide!

Thanks again

Brian
Max_admin 22 Nov, 2007
Hi Brian,

Please put again the original code you have "working well" at your html box and I will edit this and we start from this point!🙂

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
bhyland 22 Nov, 2007
Hi Max,

Thanks for your offer of help🙂 I've attached my HTML code below, I believe I have had the basic text and dropdowns working in another test version of the form using the $_POST tips on the thread but have never gotten the radio buttons working... any help much appreciated!

<p>Please include any questions in the "Additional Comments" section at the bottom.</p>
<p><h2>Section One</h2></p>
  <label></label>
  <table width="500" border="0" cellspacing="2" cellpadding="2">
    <tr>
      <td width="286">First Name </td>
      <td colspan="2"><input name="firstname" type="text" id="firstname" size="25" maxlength="30" onClick="javascript:«»showsimple()"/></td>
    </tr>
    <tr>
      <td width="286">Last Name </td>
      <td colspan="2"><input name="lastname" type="text" id="lastname" size="25" maxlength="30" /></td>
    </tr>
    <tr>
      <td width="286">Address1 </td>
      <td colspan="2"><input name="address1" type="text" id="address1" size="30" maxlength="40" /></td>
    </tr>
    <tr>
      <td width="286">Address2</td>
      <td colspan="2"><input name="address2" type="text" id="address2" size="30" maxlength="40" /></td>
    </tr>
    <tr>
      <td width="286">City</td>
      <td colspan="2"><input name="city" type="text" id="city" size="30" maxlength="40" /></td>
    </tr>
    <tr>
      <td width="286">State</td>
      <td colspan="2"><select name="select">
        <option></option>
        <option selected="selected">AL</option>
    	<option>AK</option>
    	<option>AR</option>
    	<option>AZ</option>
    	<option>CA</option>
    	<option>CO</option>
    	<option>CT</option>
    	<option>DC</option>
    	<option>DE</option>
    	<option>FL</option>
    	<option>GA</option>
    	<option>HI</option>
    	<option>ID</option>
    	<option>IL</option>
    	<option>IN</option>
    	<option>IA</option>
    	<option>KS</option>
    	<option>KY</option>
    	<option>LA</option>
    	<option>ME</option>
    	<option>MD</option>
    	<option>MA</option>
    	<option>MI</option>
    	<option>MN</option>
    	<option>MS</option>
    	<option>MO</option>
    	<option>MT</option>
    	<option>NE</option>
    	<option>NV</option>
    	<option>NH</option>
    	<option>NJ</option>
    	<option>NM</option>
    	<option>NY</option>
    	<option>NC</option>
    	<option>ND</option>
    	<option>OH</option>
    	<option>OK</option>
    	<option>OR</option>
    	<option>PA</option>
    	<option>RI</option>
    	<option>SC</option>
    	<option>SD</option>
    	<option>TN</option>
    	<option>TX</option>
    	<option>UT</option>
    	<option>VT</option>
    	<option>VA</option>
    	<option>WA</option>
    	<option>WV</option>
    	<option>WI</option>
    	<option>WY</option>
   	  </select></td>
    </tr>
    <tr>
      <td width="286">Zip Code </td>
      <td colspan="2"><input name="zipcode" type="text" id="zipcode" size="5" maxlength="5" /></td>
    </tr>
    <tr>
      <td width="286">Email address </td>
      <td colspan="2"><input name="client_email" type="text" id="client_email" size="30" maxlength="40" /></td>
    </tr>
    <tr>
      <td width="286">Home Telephone</td>
      <td colspan="2"><input name="home_phone" type="text" id="home_phone" size="10" maxlength="10" /></td>
    </tr>
    <tr>
      <td width="286">Work Telephone </td>
      <td colspan="2"><input name="work_phone" type="text" id="work_phone" size="10" maxlength="10" /></td>
    </tr>
    <tr>
      <td width="286">Mobile Telephone </td>
      <td colspan="2"><input name="cell_phone" type="text" id="cell_phone" size="10" maxlength="10" /></td>
    </tr>
    <tr>
      <td width="286">Place of Birth </td>
      <td colspan="2"><input name="birth_place" type="text" id="birth_place" size="30" maxlength="40" /></td>
    </tr>
    <tr>
      <td width="286"><label>Date of Birth (MM/DD/YYYY) </label>
          <label></label></td>
      <td colspan="2"><label>
        <select name="MM" id="MM">
          <option value="01">01</option>
          <option value="02">02</option>
          <option value="03">03</option>
          <option value="04">04</option>
          <option value="05">05</option>
          <option value="06">06</option>
          <option value="07">07</option>
          <option value="08">08</option>
          <option value="09">09</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
        </select>
        </label>
          <label>
          <select name="DD" id="DD">
            <option value="01">01</option>
            <option value="02">02</option>
            <option value="03">03</option>
            <option value="04">04</option>
            <option value="05">05</option>
            <option value="07">06</option>
            <option value="09">08</option>
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
            <option value="13">13</option>
            <option value="14">14</option>
            <option value="15">15</option>
            <option value="16">16</option>
            <option value="17">17</option>
            <option value="18">18</option>
            <option value="19">19</option>
            <option value="20">20</option>
            <option value="21">21</option>
            <option value="22">22</option>
            <option value="23">23</option>
            <option value="24">24</option>
            <option value="25">25</option>
            <option value="26">26</option>
            <option value="27">27</option>
            <option value="28">28</option>
            <option value="29">29</option>
            <option value="30">30</option>
            <option value="31">31</option>
          </select>
          </label>
          <label>
          <select name="YYYY" id="YYYY">
    		<option selected="selected">2007</option>
    		<option>2006</option>
    		<option>2005</option>
    		<option>2004</option>
   			<option>2003</option>
    <option>2002</option>
    <option>2001</option>
    <option>2000</option>
    <option>1999</option>
    <option>1998</option>
    <option>1997</option>
    <option>1996</option>
    <option>1995</option>
    <option>1994</option>
    <option>1993</option>
    <option>1992</option>
    <option>1991</option>
    <option>1990</option>
    <option>1989</option>
    <option>1988</option>
    <option>1987</option>
    <option>1986</option>
    <option>1985</option>
    <option>1984</option>
    <option>1983</option>
    <option>1982</option>
    <option>1981</option>
    <option>1980</option>
    <option>1979</option>
    <option>1978</option>
    <option>1977</option>
    <option>1976</option>
    <option>1975</option>
    <option>1974</option>
    <option>1973</option>
    <option>1972</option>
    <option>1971</option>
    <option>1970</option>
    <option>1969</option>
    <option>1968</option>
    <option>1967</option>
    <option>1966</option>
    <option>1965</option>
    <option>1964</option>
    <option>1963</option>
    <option>1962</option>
    <option>1961</option>
    <option>1960</option>
    <option>1959</option>
    <option>1958</option>
    <option>1957</option>
    <option>1956</option>
    <option>1955</option>
    <option>1954</option>
    <option>1953</option>
    <option>1952</option>
    <option>1951</option>
    <option>1950</option>
    <option>1949</option>
    <option>1948</option>
    <option>1947</option>
    <option>1946</option>
    <option>1945</option>
    <option>1944</option>
    <option>1943</option>
    <option>1942</option>
    <option>1941</option>
    <option>1940</option>
    <option>1939</option>
    <option>1938</option>
    <option>1937</option>
    <option>1936</option>
    <option>1935</option>
    <option>1934</option>
    <option>1933</option>
    <option>1932</option>
    <option>1931</option>
    <option>1930</option>
    <option>1929</option>
    <option>1928</option>
    <option>1927</option>
    <option>1926</option>
    <option>1925</option>
    <option>1924</option>
    <option>1923</option>
    <option>1922</option>
    <option>1921</option>
    <option>1920</option>
    <option>1919</option>
    <option>1918</option>
    <option>1917</option>
    <option>1916</option>
    <option>1915</option>
    <option>1914</option>
    <option>1913</option>
    <option>1912</option>
    <option>1911</option>
    <option>1910</option>
    <option>1909</option>
    <option>1908</option>
          </select>
        </label></td>
    </tr>
    <tr>
      <td width="286">U.S. Citizen </td>
      <td colspan="2"><p>
          <label>
<input name="citizen" type="radio" value="Yes" />            
Yes</label>
          <label>
            <input type="radio" name="citizen" value="No" />
            No</label>
          <br />
      </p></td>
    </tr>
    <tr>
      <td width="286">What is your State of Residence </td>
      <td colspan="2"><select name="select2">
        <option></option>
        <option selected="selected">AL</option>
    	<option>AK</option>
    	<option>AR</option>
    	<option>AZ</option>
    	<option>CA</option>
    	<option>CO</option>
    	<option>CT</option>
    	<option>DC</option>
    	<option>DE</option>
    	<option>FL</option>
    	<option>GA</option>
    	<option>HI</option>
    	<option>ID</option>
    	<option>IL</option>
    	<option>IN</option>
    	<option>IA</option>
    	<option>KS</option>
    	<option>KY</option>
    	<option>LA</option>
    	<option>ME</option>
    	<option>MD</option>
    	<option>MA</option>
    	<option>MI</option>
    	<option>MN</option>
    	<option>MS</option>
    	<option>MO</option>
    	<option>MT</option>
    	<option>NE</option>
    	<option>NV</option>
    	<option>NH</option>
    	<option>NJ</option>
    	<option>NM</option>
    	<option>NY</option>
    	<option>NC</option>
    	<option>ND</option>
    	<option>OH</option>
    	<option>OK</option>
    	<option>OR</option>
    	<option>PA</option>
    	<option>RI</option>
    	<option>SC</option>
    	<option>SD</option>
    	<option>TN</option>
    	<option>TX</option>
    	<option>UT</option>
    	<option>VT</option>
    	<option>VA</option>
    	<option>WA</option>
    	<option>WV</option>
    	<option>WI</option>
    	<option>WY</option>
      </select></td>
    </tr>
    <tr>
      <td width="286">Have you ever been convicted of a crime? </td>
      <td colspan="2"><label>
        <input type="radio" name="crime" value="Yes" />
Yes</label>
        <label>
        <input name="crime" type="radio" value="No" />
No</label></td>
    </tr>
    <tr>
      <td width="286">Are you involved in any Domestic Violence issue? </td>
      <td colspan="2"><label>
        <input type="radio" name="domestic" value="Yes" />
Yes</label>
        <label>
        <input name="domestic" type="radio" value="No"/>
No</label></td>
    </tr>
    <tr>
      <td width="286"><p>Have you ever been convicted of Domestic Violence anywhere? </p>      </td>
      <td colspan="2"><label>
        <input type="radio" name="domestic_convicted" value="Yes" />
Yes</label>
        <label>
        <input name="domestic_convicted" type="radio" value="No"/>
No</label></td>
    </tr>
    <tr>
      <td width="286">Are you an alcoholic? </td>
      <td colspan="2"><label>
        <input type="radio" name="alcoholic" value="Yes" />
Yes</label>
        <label>
        <input name="alcoholic" type="radio" value="No"/>
No</label></td>
    </tr>
    <tr>
      <td width="286">Do you use any narcotic or controlled substance?</td>
      <td colspan="2"><label>
        <input type="radio" name="narcotic" value="Yes" />
Yes</label>
        <label>
        <input name="narcotic" type="radio" value="No"/>
No</label></td>
    </tr>
    <tr>
      <td width="286"><p>Have you ever been confined to a hospital for a mental disorder? </p>      </td>
      <td colspan="2"><label>
        <input type="radio" name="mental_health" value="Yes" />
Yes</label>
        <label>
        <input name="mental_health" type="radio" value="No"/>
No</label></td>
    </tr>
    <tr>
      <td width="286">Might you have any outstanding warrants or unresolved legal issues? </td>
      <td colspan="2"><label>
        <input type="radio" name="warrants" value="Yes" />
Yes</label>
      <label>
        <input name="warrants" type="radio" value="No"/>
No</label></td>
    </tr>
    <tr>
      <td width="286">Have you eve been denied a firearms permit or had one revoked </td>
      <td colspan="2"><label>
        <input type="radio" name="permit" value="Yes" />
Yes</label>
        <label>
        <input name="permit" type="radio" value="No"/>
No</label></td>
    </tr>
    <tr>
      <td width="286">Which course(s) are you interested in? </td>
      <td colspan="2"><input name="course" type="text" id="course" size="30" maxlength="60" /></td>
    </tr>
    <tr>
      <td width="286">Do you have any health or physical concerns that may effect your ability to do physical activity, or require special accomodation? </td>
      <td colspan="2"><label>
        <input type="radio" name="health" value="Yes" />
Yes</label>
        <label>
        <input name="health" type="radio" value="No"/>
No</label></td>
    </tr>
     	<tr>
      <td width="286">Fugitive Recovery Agent and Security Training?  </td>
      <td colspan="2"><label>
        <input name="advanced" id="advanced" type="radio" value="Yes" onclick="javascript:«»showadv()"/> Yes</label>
        <label><INPUT name="advanced" id="advanced" TYPE="radio" VALUE="No" onClick="javascript:«»showsimple()"/> No</label>
         </a></td>
    </tr>
	</table>
<div id='extrabits' style='display:none'>
	<p><h2>Section Two</h2><p>
       <table>
		<tr>
      <td width="286">Will you consent to a background investigation? </td>
      <td colspan="2"><label>
        <input name="background" type="radio" value="Yes" />
Yes</label>
       <label>
        <input name="background" type="radio" value="No" />
No</label></td>
    </tr>
    <tr>
      <td width="286">Will you have medical clearance to participate in related physical activities? </td>
      <td colspan="2"><label>
        <input type="radio" name="medical" value="Yes" />
Yes</label>
        <label>
        <input name="medical" type="radio" value="No" />
No</label></td>
    </tr>
    <tr>
      <td width="286">Height</td>
      <td width="10"><input name="height_ft" type="text" id="height_ft" size="2" maxlength="1" />
      ft</td>
      <td width="10"><label>
        <input name="height_in" type="text" id="height_in" size="2" maxlength="2" />
      in</label></td>
    </tr>
    <tr>
      <td width="286">Weight (lb) </td>
      <td colspan="2"><label>
        <input name="weight" type="text" id="weight" size="3" maxlength="3" />
      lbs</label></td>
    </tr>
    <tr>
      <td width="286">Eye color </td>
      <td colspan="2"><input name="eye" type="text" id="eye" size="10" maxlength="10" /></td>
    </tr>
    <tr>
      <td width="286">Hair color </td>
      <td colspan="2"><input name="hair" type="text" id="hair" size="10" maxlength="10" /></td>
    </tr>
    <tr>
      <td width="286">Do you currently have medical coverage? </td>
      <td colspan="2"><label>
        <input name="med_coverage" type="radio" value="Yes" />
Yes</label>
        <label>
        <input name="med_coverage" type="radio" value="No" />
No</label></td>
    </tr>
    <tr>
      <td width="286">Highest level of education? </td>
      <td colspan="2"><select name="education" id="education">
        <option value="" selected="selected"></option>
        <option value="High School">High School</option>
        <option value="Bachelor's Degree">Bachelor's Degree</option>
        <option value="Master's Degree">Master's Degree</option>
        <option value="Doctorate">Doctorate</option>
      </select>
      </td>
    </tr>
    <tr>
      <td width="286">What certifications do you currently hold (valid)? </td>
      <td colspan="2"><textarea name="certifications" cols="30" rows="3" id="certifications"></textarea></td>
    </tr>
    <tr>
      <td width="286">Are you currently working in security or related field?</td>
      <td colspan="2"><label>
        <input name="security" type="radio" value="Yes" />
Yes</label>
        <label>
        <input name="security" type="radio" value="No" />
No</label></td>
    </tr>
    <tr>
      <td width="286">In case of emergency who should be contacted?</td>
      <td colspan="2"><input name="emergency" type="text" id="emergency" size="30" maxlength="40" /></td>
    </tr>
    <tr>
      <td width="286">Emergency contact telephone </td>
      <td colspan="2"><input name="emergency_contact" type="text" id="emergency_contact" size="10" maxlength="10" /></td>
    </tr>
    <tr>
      <td width="286">Your blood type </td>
      <td colspan="2"><select name="blood" id="blood">
        <option value="" selected="selected"></option>
        <option value="O+">O+</option>
        <option value="A+">A+</option>
        <option value="B+">B+</option>
        <option value="AB+">AB+</option>
        <option value="O-">O-</option>
        <option value="A-">A-</option>
        <option value="B-">B-</option>
        <option value="AB-">AB-</option>
      </select>
      </td>
    </tr>
    <tr>
      <td width="286">Allergies (including dog)</td>
      <td colspan="2"><textarea name="allergies" cols="30" rows="3" id="allergies"></textarea></td>
    </tr>
    <tr>
      <td width="286">Any medical condition of concern?</td>
      <td colspan="2"><label>
        <input name="med_concern" type="radio" value="Yes" />
Yes</label>
        <label>
        <input name="med_concern" type="radio" value="No" />
No</label></td>
    </tr>
    <tr>
      <td width="286">Do you hold a valid drivers license?</td>
      <td colspan="2"><label>
        <input name="driver" type="radio" value="Yes" />
Yes</label>
       <label>
        <input name="driver" type="radio" value="No" />
No</label></td>
    </tr>
    <tr>
      <td width="286">Do you have a vehicle?</td>
      <td colspan="2"><label>
        <input name="vehicle" type="radio" value="Yes" />
Yes</label>
       <label>
        <input name="vehicle" type="radio" value="No" />
No</label></td>
    </tr>
     </table>
</div>
<div id='footerbits'>
	<table>
		<tr>
      <td width="286">Additional Comments </td>
      <td colspan="2"><textarea name="comments" cols="30" rows="6" id="comments"></textarea></td>
    </tr>
<tr>
    <td>Please enter verification code</td>
      <td>{imageverification}</td>
      </tr>
		<tr>
      <td><input type="submit" name="Submit" value="Submit" />
      <input name="Reset" type="reset" id="Reset" value="Reset" /></td>
		</tr>
	</table>
</div>
Max_admin 23 Nov, 2007
Hi Brian,

So, for example this piece :

<input name="citizen" type="radio" value="Yes" />            
Yes</label>
          <label>
            <input type="radio" name="citizen" value="No" />


will be :


<input name="citizen" type="radio" <?php if($_POST['citizen'] == 'Yes')echo 'checked'; ?> value="Yes" />            
Yes</label>
          <label>
            <input type="radio" name="citizen" <?php if($_POST['citizen'] == 'No')echo 'checked'; ?> value="No" />


please try it!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
bhyland 26 Nov, 2007
Hi Max / Bob,

Thanks again for all your help, this did the trick🙂 I have one small thing I'm working on but will try and work it out myself first before I post ANOTHER request for help😉 learning very slowly😀

Cheers

Brian
sjnims 29 Jun, 2008
Ran into an interesting problem today and haven't been able to google an answer yet...

I have successfully used the snippet of php to save field values when a user does not enter in the correct security code.

The issue I'm having now is the reset button does not work anymore! Before a user submits the form (with or with out the correct security code) the reset button works fine. After a submit and incorrect security code, reset doesn't work!

Its a basic reset button:

<input name="reset" value="Reset" type="reset"/>


I've even tried adding:

onclick="reset()"


but that did not work either.

Help!

Thanks,

Steve
http://www.gammanu.org
GreyHead 29 Jun, 2008
HI sjnims,

What's the php snippet you've used? Is the form on-line to take a look?

Bob
GreyHead 29 Jun, 2008
Hi sjnims,

Hmmm, technically the form works perfectly, it resets to the default values. But once you've submitted the form the default values are the ones you've submitted. Try changing one of the entries and see what happens.

If you want the form to blank-out then you are going to need a bit more code. Frankly I wouldn't bother.

Bob
sjnims 29 Jun, 2008
That's goofy...I filled out the form and submitted with an incorrect security code, the values I initially put are pre-loaded as they should, then I changed one of the fields and on reset it changed back to the pre-loaded value.
GreyHead 29 Jun, 2008
Hi sjnims,

That's the correct behaviour - Reset reapplies the default values, and the default values are now the pre-loaded ones.

Bob
sjnims 29 Jun, 2008
So then so far everything is doing what it should, now how do I get it to do what I want (clear the form)?
GreyHead 29 Jun, 2008
Hi sjnims,

As I said - I wouldn't bother, how often is this functionality going to be needed? I don't even know how you'd go about it without hacking the ChronoForms code.

Bob
sjnims 29 Jun, 2008
Haha...I know it probably won't be needed, but really just for my own satisfaction. I agree though, its not needed.

Now on to more important things...

I'm trying to use CF to help me build an feature into my website so the users can log community service hours of theirs, and then allow certain users to create reports on that data. We'll see how that goes, and if I'm VERY ambitious, I plan on using CF to replace the community builder register and edit profile pages...I'm trying to keep everything uniform and use the same validation features as what I have in CF.
GreyHead 29 Jun, 2008
Hi sjnims,

Thinking abotu this, I think JavScript Reset button to re-set all teh field values to "" would do the trick. With anything that actually submits you have to hack ChronoForms to bypass the Anti-Spam which kind of defeats the purpose of having it there.

Look a the CB Registration Plugin for the first part of your project.

Bob
Bigjohn 08 Jul, 2008
Hi guys, been fiddling with Chronoforms for the first time and I'm very impressed. Very flexible and I like the email template function.

I encountered the same problem: forms gets reset after entering an invalid security code. I also noticed that sometimes it fails even when I enter the exact code.

I have been trying to add the code as suggested in the FAQ. The form is quite extensive but my main concern is the text areas. Form can be seen here: http://bawbag.nl/subwebs/voetreflex/index.php?option=com_chronocontact&Itemid=61

My problem is that I create an html form in Dreamweaver, and paste the code in the Chronoform admin screen (form code). I just can't figure out what code I need to add to get the old input back when the verification fails. You guys gave examples in PHP, and my code is in HTML. Can you tell me what the correct syntax is in HTML? I´m a bit of a PHP newbie :blush:

For instance, here's a code sample from my form, a textfield:

<td bgcolor="#F3F3F3">Naam:
</td>

<td width="300"> 
	<div align="left">
        <input name="naam" type="text" id="naam" size="40" maxlength="40" />*
	</div>
</td>


I really need this resolved to take the form into production, if I fail I need to wait for the new release with improved verification I´m affraid. Thx for the help!
GreyHead 08 Jul, 2008
Hi BigJohn,

You need to set the field value to the value held in the $_POST array like:
<input name="naam" type="text" id="naam" 
size="40" maxlength="40" value="<?php echo $_POST['naam']; ?>" />
The FAQ is broken and I hven't fixed it because Max tells me that the next release of ChronoForms will handle some or all of this for you. But he keep on adding more features so the next release gets pushed back - not sure if that's good or not.

Bob
Bigjohn 08 Jul, 2008
Bob, thx for the swift reply. Actually it should be
<input name="naam" type="text" id="naam" size="40" 
maxlength="40" value="<?php echo $_POST['naam']; ?>" />


But thx for pointing me in the right direction! Works like a charm, I'm sure I will figure out now how to do the same for the radio buttons.

As for new features, as a project manager I think it's not a good thing to push back the date😉
But I thank you for all the hard work guys, great job.
GreyHead 08 Jul, 2008
Hi Bigjohn,

Good catch, I fixed my post thanks.

Here's a recent version of a radio button validation - this is more complex that you probably need but the principals should be clear.[code] <div><label for='1_gender'>Gender </label>
<?php
// set checked field for radio buttons
$check = array('m' => '', 'f' => '');
foreach ($check as $k => $v ) {
if ( $k == $team_array[1]['gender'] ) {
$check[$k] = "checked='checked'";
} elseif ( !$edit ) {
$check[$k] = "disabled='disabled'";
}
}
?>
<input name='su_form[1][gender]' type='radio' id='1_gender_m' value='m'
<?php echo $check['m']; ?> />
Bigjohn 08 Jul, 2008
Thx Bob, but that does look complicated.
I gave it a go, but that results in radiobuttons that cannot be checked at all. I made a little test form:

[code]<form id="form2" name="test" method="post" action="">
<div><label for='1_gender'>Gender </label>
<?php
// set checked field for radio buttons
$check = array('m' => '', 'f' => '');
foreach ($check as $k => $v ) {
if ( $k == $_POST['gender'] ) {
$check[$k] = "checked='checked'";
} elseif ( !$edit ) {
$check[$k] = "disabled='disabled'";
}
}
?>
<input name='su_form[1][gender]' type='radio' id='1_gender_m' value='m'
<?php echo $check['m']; ?> />
GreyHead 09 Jul, 2008
Hi BigJohn,

I apologise, I pasted that in without checking it properly. There's also code in there to show an 'uneditable' confirmation version of the form.

I think that if you add in
<?php
$edit = true; // add this line
. . .
at the beginning all will be OK again.

Bob

PS with $edit not set both fields are being set to disabled.
Bigjohn 11 Jul, 2008
Hi Bob,

yeah I noticed it wasn't working😛 Your last line didn't do much good, buttons were editable but after submitting a wrong verification code they were blank again.

I did some research myself, and found that this works fine:

<input type="radio" name="gender" id="male" value="Male"<?php echo (isset($_POST['gender']) && $_POST['gender']=='Male')? ' checked' : '';?>> 


All is well now.

Source: http://www.webmasterworld.com/php/3058300.htm
Bigjohn 11 Jul, 2008
So to summarize, if you are using HTML to make your form and want to keep the data after a user enters an incorrect verification code, here's how to do it:

textbox:
<input name="profession" type="text" id="profession" size="45" maxlength="50" value="<?php echo $_POST['profession']; ?>" />


text area:
<textarea name="your_comments" id="your_comments" cols="45" rows="5"><?php echo $_POST['your_comments']; ?></textarea>


Radio button:
<p>
      <label>Male
      <input type="radio" name="gender" id="male" value="Male"<?php echo (isset($_POST['gender']) && $_POST['gender']=='Male')? ' checked' : '';?>> 
      </label>
      <label>Female
      <input type="radio" name="gender" id="femalew" value="Female"<?php echo (isset($_POST['gender']) && $_POST['gender']=='Female')? ' checked' : '';?>> 
      </label>


Hope this helps others.
shd 27 Apr, 2011
Hi,

I use this code from this topic in many forms and works fine, but today I make a very simple form also with this code and now it goes wrong.
I test it and it cleans my form after a wrong security image code. :?

I can't see anything wrong in my code.

My code is:
<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Naam</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_1"  value="<?php echo $_POST['naam']; ?>"  name="naam" type="text" />

  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Telefoonnummer*</label>
    
    <input class="cf_inputbox required" maxlength="150" size="30" title="Vul uw telefoonnumer in" id="text_2" value="<?php echo $_POST['telefoonnummer']; ?>" name="telefoonnummer" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">E-mail</label>
    <input class="cf_inputbox validate-email" maxlength="150" size="30" title="Graag een juist e-mails adres invullen." id="text_3" value="<?php echo $_POST['email']; ?>" name="email" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;">Commentaar</label>
    <textarea class="cf_inputbox" rows="3" id="text_4" title="" cols="30"  name="commentaar"><?php echo $_POST['commentaar']; ?></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_captcha">
    <label class="cf_label" style="width: 150px;">Anti spam code<br />
<span style="font-size:9px">(Niet hoofdletter gevoelig)</span></label>
    <span>{imageverification}</span> 
    
    </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Verzenden" name="button_8" type="submit" />
     <input name="annuleren" type="reset" onclick="MM_goToURL('parent','Contact/contactformulier.html');return document.MM_returnValue" value="Annuleren" />
  </div>
  <div class="cfclear"> </div>
</div>



Also I test this form on an other website with a good working form and it works, the data stays in the form after putting a wrong security code!

Also I put the correct working form on the website with the not correct working form and it is not working, it erase also the data after putting a wrong security code.
The conclusion is that something else gives this problem. 😑 😢 But I don't know what.

Debug information:
1. Form passed first SPAM check OK
2. Form passed the submissions limit (if enabled) OK
3. Form passed the Image verification (if enabled) OK
4. Form passed the server side validation (if enabled) OK
5. $_POST Array: Array ( [naam] => stephanie [telefoonnummer] => 061231236 [email] => [commentaar] => [chrono_verification] => ap8ey [button_8] => Verzenden [346f021603e66917f182c5ee1e504c47] => 1 [1cf1] => 673e676cb08e3e2620e006feaa800044 [chronoformname] => contactform )
6. $_FILES Array: Array ( )
7. Form passed the plugins step (if enabled) OK
8. An email has been SENT successfully from (xxx x)noreply@xxx.nl to
9. Debug End



Hopefully somebody can help me.

Regards,
Stephanie
GreyHead 28 Apr, 2011
Hi Stephanie,

I don't see anything wrong with your code - though I don't know what the MM_goToURL() JavaScript function does.

Do you need this at all though? The ChronoForms "Try to Republish" feature does a pretty good job of re-displaying the form data.

Bob
shd 29 Apr, 2011
Hi Bob,
The MM_goToURL() JavaScript function resets the form if the code
value="<?php echo $_POST['naam']; ?>" 
is used.
But that is not the problem because I tested it without this MM_goToURL JavaScript and still it reset the form. The same form is working perfect on other sites... so there is something else that reset the form.
We have also SEF 404 on this site but I put it off and still it reset the form after a wrong security code.😢, we are also using JCE the newest version.
It is a total clean site, so I don't know, I never had this strange problem.

Regards,
Stephanie
GreyHead 29 Apr, 2011
Hi Stephanie,

Do you need this at all though? The ChronoForms "Try to Republish" feature does a pretty good job of re-displaying the form data.



Bob
shd 18 Aug, 2011

Do you need this at all though? The ChronoForms "Try to Republish" feature does a pretty good job of re-displaying the form data.



What do you mean exactly? I published it and un-published it and published it again but still it reset the form.

It is so strange I never had this problem, it works always and the strange thing about this is that it works on an other website with exact the same code.
The form: http://www.vbvadvocaten.nl/Contact/contactformulier.html

regards,
Stephanie
GreyHead 19 Aug, 2011
Hi Stephanie,

Please set "Republish fields if error occured" to "Try to republish" on the Form Editor General tab.

Bob
shd 22 Aug, 2011
hi Bob,

Yes thanks that is working. Great, tnx!

But now is displaying an other problem, Joomla is generating a javascript from the email address and when I put a wrong security code than the whole script is displaying in the email field :-) in stead of the email address, pffttt.

Regards,
Stephanie

(The Joomla script which is displaying in the email field after putting a wrong security code:

<script language='JavaScript' type='text/javascript'> <!-- var prefix = 'mailto:'; var suffix = ''; var attribs = ''; var path = 'hr' + 'ef' + '='; var addy71168 = 'stephanie' + '@'; addy71168 = addy71168 + 'douma' + '.' + 'biz'; document.write( '<a ' + path + '\'' + prefix + addy71168 + suffix + '\'' + attribs + '>' ); document.write( addy71168 ); document.write( '<\/a>' ); //--> </script><script language='JavaScript' type='text/javascript'> <!-- document.write( '<span style=\'display: none;\'>' ); //--> </script>Dit e-mailadres is beschermd tegen spambots. U heeft JavaScript nodig om het te kunnen zien. <script language='JavaScript' type='text/javascript'> <!-- document.write( '</' ); document.write( 'span>' ); //--> </script>
)
GreyHead 22 Aug, 2011
Hi Stephanie,

You have the Joomla! Email Cloaking Plug-in enabled and it is trying to cloak the sample e-mail in the ChronoForms validation message. Disable the plug-in temporarily to check this is the problem. If you need the plug-in change the plug-ins order so that Email Cloaking runs before ChronoForms.

NB These are Joomla! plug-ins that you manage from Site Admin | Extensions | Plug-in Manager

Bob
This topic is locked and no more replies can be posted.