Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Form validation

  1. #1
    Join Date
    Aug 2015
    Location
    A galaxy far far away
    Posts
    257

    Default Form validation

    Hello all,

    I have created a form in 3 variants, simple name and e-mail. I have also created some javascript validation to ensure name and e-mail are not left empty when the form is submitted. For the first variant, i.e. where the name is first in the HTML source everything works fine, but on the 2nd and 3rd variants the validation keeps kicking in even though I fill in the fields. Presumable it see the first variants name field as empty.

    How can I apply validation to forms without having to give each name/email field a unique id and then duplicating the validation code three times?

  2. #2
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,813

    Default Re: Form validation

    Quote Originally Posted by nazf355 View Post
    Hello all,

    I have created a form in 3 variants, simple name and e-mail. I have also created some javascript validation to ensure name and e-mail are not left empty when the form is submitted. For the first variant, i.e. where the name is first in the HTML source everything works fine, but on the 2nd and 3rd variants the validation keeps kicking in even though I fill in the fields. Presumable it see the first variants name field as empty.

    How can I apply validation to forms without having to give each name/email field a unique id and then duplicating the validation code three times?
    I have used hidden fields in the past for tracking entered data across different pages so a similar technique may be needed here.

    Personally, I would place the form in a sub-folder/sub-site as a stand-alone page and embed it as an IFRAME - three views into one form. Not tried it though so let us know if it works.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  3. #3
    Join Date
    Aug 2015
    Location
    A galaxy far far away
    Posts
    257

    Default Re: Form validation

    Quote Originally Posted by Acorn View Post
    I have used hidden fields in the past for tracking entered data across different pages so a similar technique may be needed here.

    Acorn

    Can you expand a little bit more on this please?

  4. #4
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,813

    Default Re: Form validation

    What form widget are you using or it is your own design?
    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  5. #5
    Join Date
    Aug 2015
    Location
    A galaxy far far away
    Posts
    257

    Default Re: Form validation

    Quote Originally Posted by Acorn View Post
    What form widget are you using or it is your own design?
    Acorn
    It's my own.

  6. #6
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,916

    Default Re: Form validation

    Personally, I would place the form in a sub-folder/sub-site as a stand-alone page and embed it as an IFRAME - three views into one form. Not tried it though so let us know if it works.
    That's the way to go. I've used it and it works very well. I'll try and post a xar file later today.

    Here's a form within an iframe. It's optimised for a mobile but should work in any a supersite.

    http://parkeston.com/forms/form-in-an-iframe.htm
    Last edited by Egg Bramhill; 15 September 2015 at 04:21 AM.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  7. #7

    Default Re: Form validation

    That looks great, now for the hard bit, how to incorporate into my website?

  8. #8
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,916

    Default Re: Form validation

    Okay, let's see if I can help. I'm going to attach several files but basically the form calls a php form on your server and the php form sends you an email. I'll attach the form, open it and all that's required is to change the email address to your own email. save it and ftp it to a subfolder on your site named "forms".

    Also attached are two xar files, both with the same form but the mobile one is larger and has larger text. Instructions are included with each xar.

    A further xar file, thanks.xar, is also included for creation of the thank you page once the form is successfully sent.

    Both forms use the same form.php file.

    You can view both side by side HERE

    I can't attach a php file, so download the file form.txt and rename it form.php
    Attached Files Attached Files
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  9. #9

    Default Re: Form validation

    Thanks guy for the great response. I solved the problem with a form from Smart Addon and works fine.

  10. #10
    Join Date
    Jul 2016
    Posts
    5

    Default Re: Form validation

    Quote Originally Posted by Egg Bramhill View Post
    Okay, let's see if I can help. I'm going to attach several files but basically the form calls a php form on your server and the php form sends you an email. I'll attach the form, open it and all that's required is to change the email address to your own email. save it and ftp it to a subfolder on your site named "forms".

    Also attached are two xar files, both with the same form but the mobile one is larger and has larger text. Instructions are included with each xar.

    A further xar file, thanks.xar, is also included for creation of the thank you page once the form is successfully sent.

    Both forms use the same form.php file.

    You can view both side by side HERE

    I can't attach a php file, so download the file form.txt and rename it form.php
    Can you please give some detailed instruction on how to put this and where? It will be of much help. Btw, I have the cPanel access.

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •