Form whose script is visible when click on Google "View page source"

Issues related to forms.
Post Reply
Aris
 
 
Posts: 202
Joined: Wed Aug 28, 2013 9:28 am

Form whose script is visible when click on Google "View page source"

Post by Aris »

Ηι.

Perhaps it's common what I noticed on a webpage that contains a contact form (I used "Use bult-in PHP form processor")

Let me refer to a remark that worries me.

Please see what I've noticed:

In this web page https://www.mentorship.gr/m_communication.php

1. In Editbox > Validate > Data type I selected:
"Custom" and added the following code fro greek characters: /^[Α-Ωα-ωΆ-Ώά-ώ ]+$/

2. In Editbox > Validate > Data length, I selected:
"Data required".

When I published (either with F5 or on web), I used Google > View page source. I shaw all the following script of my communication web page:

Code: Select all

<script>   
   function Validatem_communication()
   {
      var regexp;
      var communicationEditbox1 = document.getElementById('communicationEditbox1');
      if (!(communicationEditbox1.disabled || communicationEditbox1.style.display === 'none' || communicationEditbox1.style.visibility === 'hidden'))
      {
         regexp = /^[Α-Ωα-ωΆ-Ώά-ώ ]+$/;
         if (!regexp.test(communicationEditbox1.value))
         {
            alert("The specified value is invalid.");
            communicationEditbox1.focus();
            return false;
         }
         if (communicationEditbox1.value == "")
         {
            alert("Please enter a value for the \"communicationEditbox1\" field.");
            communicationEditbox1.focus();
            return false;
         }
      }
      var communicationEditbox2 = document.getElementById('communicationEditbox2');
      if (!(communicationEditbox2.disabled || communicationEditbox2.style.display === 'none' || communicationEditbox2.style.visibility === 'hidden'))
      {
         regexp = /^[Α-Ωα-ωΆ-Ώά-ώ ]+$/;
         if (!regexp.test(communicationEditbox2.value))
         {
            alert("The specified value is invalid.");
            communicationEditbox2.focus();
            return false;
         }
         if (communicationEditbox2.value == "")
         {
            alert("Please enter a value for the \"communicationEditbox2\" field.");
            communicationEditbox2.focus();
            return false;
         }
      }
      var communicationTextArea1 = document.getElementById('communicationTextArea1');
      if (!(communicationTextArea1.disabled || communicationTextArea1.style.display === 'none' || communicationTextArea1.style.visibility === 'hidden'))
      {
         if (communicationTextArea1.value == "")
         {
            alert("Please enter a value for the \"communicationTextArea1\" field.");
            communicationTextArea1.focus();
            return false;
         }
      }
      var m_communicationEditbox1 = document.getElementById('m_communicationEditbox1');
      if (!(m_communicationEditbox1.disabled || m_communicationEditbox1.style.display === 'none' || m_communicationEditbox1.style.visibility === 'hidden'))
      {
         regexp = /^[Α-Ωα-ωΆ-Ώά-ώ ]+$/;
         if (!regexp.test(m_communicationEditbox1.value))
         {
            alert("The specified value is invalid.");
            m_communicationEditbox1.focus();
            return false;
         }
         if (m_communicationEditbox1.value == "")
         {
            alert("Please enter a value for the \"m_communicationEditbox1\" field.");
            m_communicationEditbox1.focus();
            return false;
         }
      }
      return true;
   }
</script>


The following web page is experimental:

https://www.mentorship.gr/experiment_communication.php

In this page I made none of the Previous changes (1 and 2).

In this page I noticed nothing of the above script. Now my problem is that I cannot add my own constraints.


I have the impression that it is not normal to appear the script of a form.

Probably I'm making a mistake. But I can not figure out what it is.

Thank you.
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form whose script is visible when click on Google "View page source"

Post by Pablo »

This code is part of the built-in validation tools.
http://wysiwygwebbuilder.com/validation.html
Aris
 
 
Posts: 202
Joined: Wed Aug 28, 2013 9:28 am

Re: Form whose script is visible when click on Google "View page source"

Post by Aris »

Thank you, Pablo, for the response.

But should the script may be so obvious, or I make something wrong in Form Validation?
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Form whose script is visible when click on Google "View page source"

Post by Pablo »

The script will be added if you enable form validation.
If you disable form validation then the script will not be included.
Aris
 
 
Posts: 202
Joined: Wed Aug 28, 2013 9:28 am

Re: Form whose script is visible when click on Google "View page source"

Post by Aris »

Thank you, Pablo.

Again and again.
Post Reply