close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Form Validation Failing to re-populate user form data

Thread begun 3/04/2012 7:10 am by Paul | Last modified 4/02/2012 11:13 am by Jason Byrnes | 3500 views | 13 replies |

PaulBeta Tester

Form Validation Failing to re-populate user form data

SA 2.0.4 in DW CS5.5

Error when the users email entry fails form validation (ie dupe entry), the registration page refreshes with original user data, but the radio group fails to populate with earlier user selection, returning instead the following errors against each radio; (I have replaced the original checked values set by the SA Wizard from "this" and "that" to 1)

array_search() expects parameter 2 to be array, string given in C:\xampp\htdocs\..\..\regme.php on line 167
checked="1" tabindex="5">

array_search() expects parameter 2 to be array, string given in C:\xampp\htdocs\..\..\regme.php on line 170
checked="1" tabindex="6">


The respective lines are as follows;

php:
<div class="lineGroup">
          <label for="Registration_group_Membership_Type__1" class="sublabel" > Membership:<span class="requiredIndicator">&nbsp;*</span></label>
          <div class="errorGroup"> <span id="Registration_group_Membership_Type__1_Spry"> <span class="radioFieldGroup_Narrow"> <span class="radioGroup_Narrow">
          <label class="radioSublabel_Narrow" for="Registration_group_Membership_Type__1" onBlur="hideServerError('Registration_group_Membership_Type__1_ServerError');"> I am selling&nbsp;
            <input type="radio" name="Registration_group_Membership_Type" id="Registration_group_Membership_Type__1" value="1" class="formRadioField_Standard" <?php if (array_search("1", ((isset($_GET["invalid"]) && ValidatedField("regme","Registration_group_Membership_Type"))?ValidatedField("regme","Registration_group_Membership_Type"):array())) !== false) {echo "checked=\"1\"";} ?> tabindex="5">
          </label>
          <label class="radioSublabel_Narrow" for="Registration_group_Membership_Type__2" onBlur="hideServerError('Registration_group_Membership_Type__1_ServerError');">I am buying&nbsp;
            <input type="radio" name="Registration_group_Membership_Type" id="Registration_group_Membership_Type__2" value="2" class="formRadioField_Standard" <?php if (array_search("2", ((isset($_GET["invalid"]) && ValidatedField("regme","Registration_group_Membership_Type"))?ValidatedField("regme","Registration_group_Membership_Type"):array())) !== false) {echo "checked=\"1\"";} ?> tabindex="6">
          </label>
          </span></span> </span> </div>
        </div>



The original option button values applied by SA "this" and "that" have been replaced by 1 and 2, which are the values I want sent to MySQL according to user selection.

Any ideas?

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

can you send a copy of the full page in a zip archive so i can see the code in context to troubleshoot.

Sign in to reply to this post

PaulBeta Tester

Jason,

Zipped file as requested.

Sign in to reply to this post

Jason ByrnesWebAssist

i have reproduced this issue with security assist and logged it in our system as a bug to be corrected in a future update.

to work around the problem, you will need to manually remove the bad code and reset the initial value for the radio buttons.
in the first button, delete this code:

php:
<?php if (array_search("1", ((isset($_GET["invalid"]) && ValidatedField("regme","Registration_group_Membership_Type"))?ValidatedField("regme","Registration_group_Membership_Type"):array())) !== false) {echo "checked=\"1\"";} ?>


in the second button, delete this code:

php:
<?php if (array_search("2", ((isset($_GET["invalid"]) && ValidatedField("regme","Registration_group_Membership_Type"))?ValidatedField("regme","Registration_group_Membership_Type"):array())) !== false) {echo "checked=\"1\"";} ?>



in design view, select the first radio button, in the property inspector, click the Dynamic button, click the lightning bolt icon next to select value equal to, in the bindings panel, expand the validated entries collection and select the Registration_group_Membership_Type radio group.

Sign in to reply to this post

PaulBeta Tester

Jason,

Thanks for prompt response.

This action resolved issue.

Sign in to reply to this post

Jason ByrnesWebAssist

Glad to hear it is working.

Sign in to reply to this post

PaulBeta Tester

I assumed if I wanted the same behaviour on my Checkbox, id follow the same solution, but it doesn't seem to work.

That is if the checkbox is selected, and for submit fails, the checkbox refreshes as empty.

Sign in to reply to this post

Jason ByrnesWebAssist

check box is a little different, click the lightning bolt next to check if and select the corresponding validated entry. then in the equal to box, type the checked value for the checkbox.

Sign in to reply to this post

PaulBeta Tester

Hi,

I have applied your suggestion as per below;

php:
<input <?php if (!(strcmp((ValidatedField("newreg_501","AcceptTerms")),1))) {echo "checked=\"checked\"";} ?> type="checkbox" name="AcceptTerms" id="AcceptTerms" value="1" />



However, the checkbox value is not being returned after the form validates and errors on submission.

any ideas.

Sign in to reply to this post

Jason ByrnesWebAssist

please send a link where i can see the problem and a copy of the page.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...