PDA

View Full Version : Reset Button


FARRSX4397970
01-25-2010, 12:28 PM
Is there an easy way to add a reset button that looks like the submit image in the Contact form solutions pack. This is the text I have now.
<a href="contactus.php">Reset the Code</a>

neilo
01-25-2010, 04:48 PM
If you want a button that just resets the form (but won't reset the captcha image):

Insert > Form > Button - and in the Properties Panel/Inspector set the action to 'Rest Form'
Make sure that the button is inside the form tags.

If you want a button to refresh your form page (so that the form resets and the captcha image changes):

Insert a button - Insert > Form > Button
In Properties Panel/Inspector, for 'Action' select 'None' - give it a value, i.e 'Reset'.
Go to Window > Behaviors and in the Behaviors Panel, click the plus sign and from the options select 'Go to URL'. Enter 'contactus.php' for the URL.

FARRSX4397970
02-04-2010, 06:33 PM
What if you just want captcha image to change only?

Jimmy Wu
02-05-2010, 11:36 AM
In your contact_styled.php page, you will have to find the image code:
<img src="WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?noisecolor=<?php echo $WAGLOBAL_Captcha_Noise; ?>&bgcolor=<?php echo $WAGLOBAL_Captcha_BG; ?>&textcolor=<?php echo $WAGLOBAL_Captcha_Text; ?>&transparent=<?php echo $WAGLOBAL_Captcha_BG_transparent; ?>&characters=<?php echo $WAGLOBAL_Captcha_Characters; ?>&width=<?php echo $WAGLOBAL_Captcha_Width; ?>&height=<?php echo $WAGLOBAL_Captcha_Height; ?>&font=<?php echo $WAGLOBAL_Captcha_Font; ?>" alt="security code"/>

Add an id to it like this:
<img src="WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?noisecolor=<?php echo $WAGLOBAL_Captcha_Noise; ?>&bgcolor=<?php echo $WAGLOBAL_Captcha_BG; ?>&textcolor=<?php echo $WAGLOBAL_Captcha_Text; ?>&transparent=<?php echo $WAGLOBAL_Captcha_BG_transparent; ?>&characters=<?php echo $WAGLOBAL_Captcha_Characters; ?>&width=<?php echo $WAGLOBAL_Captcha_Width; ?>&height=<?php echo $WAGLOBAL_Captcha_Height; ?>&font=<?php echo $WAGLOBAL_Captcha_Font; ?>" alt="security code" id="captchaImage" />

Then you will have to add a script like this:

<script language="JavaScript">
function reloadImage() {
var now = new Date();
if (document) {
document.getElementById('captchaImage').src = "WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?noisecolor=" + "<?php echo $WAGLOBAL_Captcha_Noise; ?>" + "&bgcolor=" + "<?php echo $WAGLOBAL_Captcha_BG; ?>" + "&textcolor=" + "<?php echo $WAGLOBAL_Captcha_Text; ?>" + "&transparent=" + "<?php echo $WAGLOBAL_Captcha_BG_transparent; ?>" + "&characters=" + "<?php echo $WAGLOBAL_Captcha_Characters; ?>" + "&width=" + "<?php echo $WAGLOBAL_Captcha_Width; ?>" + "&height=" + "<?php echo $WAGLOBAL_Captcha_Height; ?>" + "&font=" + "<?php echo $WAGLOBAL_Captcha_Font; ?>" + "&time=" + now.getTime();
}
}
</script>

and a button that calls the reload function like this:
<input type="button" name="Button" id="button" value="Button" onclick="reloadImage()" />

FARRSX4397970
02-12-2010, 06:51 AM
Thankyou worked great!

phebberd116714
07-31-2010, 06:22 AM
I can get the button working following your instructions but the refreshed image I get is ugly and unreadable.

This is the code that generates my captcha image. It was created with form builder:

<img src="WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?field=captchaField&amp; transparent=false&amp;noisecolor=99CCCC&amp;noiseorder=0&amp;g ridfreq=25&amp;gridcolor=FFFF00&amp;gridorder=0&amp;font=Fonts/MYTYPE.TTF&amp;characters=6&amp;textcolor=333333" alt="Security Code" class="Captcha" id="captchaImage" />

How do I translate that into the js script.

Thanks

Jason Byrnes
08-02-2010, 08:21 AM
change:

document.getElementById('captchaImage').src = "WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?noisecolor=" + "<?php echo $WAGLOBAL_Captcha_Noise; ?>" + "&bgcolor=" + "<?php echo $WAGLOBAL_Captcha_BG; ?>" + "&textcolor=" + "<?php echo $WAGLOBAL_Captcha_Text; ?>" + "&transparent=" + "<?php echo $WAGLOBAL_Captcha_BG_transparent; ?>" + "&characters=" + "<?php echo $WAGLOBAL_Captcha_Characters; ?>" + "&width=" + "<?php echo $WAGLOBAL_Captcha_Width; ?>" + "&height=" + "<?php echo $WAGLOBAL_Captcha_Height; ?>" + "&font=" + "<?php echo $WAGLOBAL_Captcha_Font; ?>" + "&time=" + now.getTime();


to:

document.getElementById('captchaImage').src = "WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?noisecolor=99CCCC&bgcolor=FFFF00&textcolor=333333&transparent=false&characters=6&font=Fonts/MYTYPE.TTF&time=" + now.getTime();

elevy388997
08-25-2010, 11:22 AM
Hope you can help me out here, I get the idea, but having different values than these examples is throwing me off. (just refresh the captcha image only)


<div class="fieldGroup"> <img src="WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?field=Contact_me_gr oup_Security_code&amp;width=140&amp;height=50&amp;bgcolor=0000 00&amp;transparent=false&amp;noisefreq=25&amp;gridfreq=50&amp;grid color=FFFFFF&amp;gridorder=0&amp;font=Fonts/MODERNA_.TTF&amp;textcolor=990000" alt="Security Code" class="Captcha" /> </div>

Jason Byrnes
08-25-2010, 12:00 PM
you just need to add an id to the image tag:

<div class="fieldGroup"> <img src="WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?field=Contact_me_gr oup_Security_code&amp;width=140&amp;height=50&amp; bgcolor=000000&amp;transparent=false&amp;noisefreq =25&amp;gridfreq=50&amp;gridcolor=FFFFFF&amp;grido rder=0&amp;font=Fonts/MODERNA_.TTF&amp;textcolor=990000" alt="Security Code" class="Captcha" id="captchaImage" /> </div>



and add the script as:

<script language="JavaScript">
function reloadImage() {
var now = new Date();
if (document) {
document.getElementById('captchaImage').src = "WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?field=Contact_me_gr oup_Security_code&amp;width=140&amp;height=50&amp; bgcolor=000000&amp;transparent=false&amp;noisefreq =25&amp;gridfreq=50&amp;gridcolor=FFFFFF&amp;grido rder=0&amp;font=Fonts/MODERNA_.TTF&amp;textcolor=990000";
}
}
</script>

elevy388997
08-25-2010, 05:24 PM
It works except it resets the formatting on the captcha. How to change that? http://www.levy4u.com/contact.php

Jason Byrnes
08-26-2010, 07:03 AM
change this line:

document.getElementById('captchaImage').src = "WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?noisecolor=" + "" + "&bgcolor=" + "" + "&textcolor=" + "" + "&transparent=" + "" + "&characters=" + "" + "&width=" + "" + "&height=" + "" + "&font=" + "" + "&time=" + now.getTime();



to:

document.getElementById('captchaImage').src = "WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?field=Contact_me_gr oup_Security_code&amp;width=140&amp;height=50&amp;bgcolor=0000 00&amp;transparent=false&amp;noisefreq=25&amp;gridfreq=50&amp;grid color=FFFFFF&amp;gridorder=0&amp;font=Fonts/MODERNA_.TTF&amp;textcolor=990000";

ShorePatrol
08-27-2010, 04:27 AM
I got this to refresh the image only, BUT, it seems that if you don't refresh the image and submit, it works as expected...

If you refresh the image 1 or more times, and submit (even with the correct captcha code) it says your captcha code was not correct.

Seems like when the page loads originally it "knows" the captcha value. When you refresh it without refreshing the page, this creates a mismatch and it's then impossible to submit the right captcha value...not sure but I can't get this to submit after I've refreshed the image.

So be careful using this technique - hopefully this will be a built in feature in version 2.

elevy388997
08-27-2010, 04:44 PM
change this line:

document.getElementById('captchaImage').src = "WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?noisecolor=" + "" + "&bgcolor=" + "" + "&textcolor=" + "" + "&transparent=" + "" + "&characters=" + "" + "&width=" + "" + "&height=" + "" + "&font=" + "" + "&time=" + now.getTime();



to:

document.getElementById('captchaImage').src = "WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?field=Contact_me_gr oup_Security_code&amp;width=140&amp;height=50&amp;bgcolor=0000 00&amp;transparent=false&amp;noisefreq=25&amp;gridfreq=50&amp;grid color=FFFFFF&amp;gridorder=0&amp;font=Fonts/MODERNA_.TTF&amp;textcolor=990000";


I tried that and it still changes the formatting but now only lets it reset once and doesn't accept the new captcha code.

Jason Byrnes
08-30-2010, 10:21 AM
In reality, this is not a supported function. It is not something that is built into the captcha of css form builder.

I will add a feature request to have this considered for the future.

ShorePatrol
08-30-2010, 10:39 AM
Jason,

That would be great, because we all know that some captcha code rendering is very difficult to decipher. Not too mention, many captcha components allow for refreshing the image, some even allow for an audio to play to hear it spelled out - although I'd be quite happy with a working refresh option.

Thanks

pmait97856
09-15-2010, 09:12 AM
I have been following along with this thread.

I have almost everything working on my form with the exception of the regenerated captcha code.

The Captcha image changes when the button is pressed but it is not being recognised by the form. So when putting in the new code and clicking the submit button, the page is returned/refreshed with a new Captcha image as though the user input the incorrect code.

Would this be a problem with the server validation code on my page.

I have attached a copy of the page.

Jason Byrnes
09-15-2010, 09:19 AM
the reality is that this is not supported in form builder.

It may work in some instances, but not in all.

I have added a feature request to have a reset option considered for the future.