Loading ...
Sorry, an error occurred while loading the content.

Re: [JavaScript] Page redirect

Expand Messages
  • Michael Pakay - www.NJCGL.com League Coo
    Actually I m performing data checking. Making sure a user fills in all required fields. My problem is this. When JavaScript is enabled and a user does not
    Message 1 of 10 , Oct 3, 2006
    • 0 Attachment
      Actually I'm performing data checking. Making sure a user fills in all
      required fields. My problem is this. When JavaScript is enabled and a
      user does not fill in a required field, the JavaScript function will
      warn the user and disable the button to append to the database. If
      JavaScript is disabled, the database will be appended with potentially
      useless information.I am in the process of redesigning my menus using
      code from www.Milonic.com. This will disable my menu if JavaScript is
      not enabled which will stop all database appends. Unfortunately this
      will also render my site useless without JavaScript.

      I also tried
      <noscript><meta http-equiv="refresh"
      content="0;url=http://www.your-site.com/EnableJavaScript.html
      <http://www.your-site.com/EnableJavaScript.html>"></noscript>
      This works well in FireFox but produces an error with IE.

      Any ideas will be appreciated.

      m

      David Smart wrote:
      >
      > Are you saying that you are using JavaScript to validate data before using
      > it on your server (e.g. to put it in a database)? Don't. There are always
      > ways to circumvent this and the unscrupulous will do nasty things.
      >
      > Proper data validation (for your protection) MUST be done on your server.
      >
      > You can do data checking on the browser too (for the user) by all
      > means. It
      > is quicker and users will prefer it.
      >
      > Regards, Dave S
      >
      > ----- Original Message -----
      > From: "Michael Pakay" <pakaymc@... <mailto:pakaymc%40gmail.com>>
      > To: <JavaScript_Official@yahoogroups.com
      > <mailto:JavaScript_Official%40yahoogroups.com>>
      > Sent: Tuesday, October 03, 2006 3:10 AM
      > Subject: [JavaScript] <noscript></noscript> Page redirect
      >
      > >I use JavaScript on my site for data validation. If a user turns off
      > > JavaScript data verification is also turned off. I use the
      > > <noscript></noscript> in the body to request that the user turn on
      > > JavaScript but this does not help with data verification.
      > >
      > > Can I redirect a user to a page, EnableJavaScript.html with in
      > > <noscript></noscript>? This will give me the opportunity to give full
      > > directions on how to enable JS and give a full explanation on the
      > > advantages of JS for my site.
      > >
      > >
      > > TIA
      > >
      > > Michael Pakay
      > >
      > > pakaymc@... <mailto:pakaymc%40gmail.com>
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > > Visit http://aiaiai.com <http://aiaiai.com> for more groups to join
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      >
      >
    • Ernesto Mendoza Blanco
      Form validation is easy with php, take this as an example: registration.php-----------
      Message 2 of 10 , Oct 4, 2006
      • 0 Attachment
        Form validation is easy with php, take this as an example:

        registration.php-----------
        <?php
        if($_POST['send']){
        $error = false;
        $name = mysql_real_escape_string($_POST['name']); //always escape your
        vars
        $lastname = mysql_real_escape_string($_POST['lastname']);
        if( empty($name) && empty($lastname) ){
        $error = 'Form incomplete!!';
        }else{
        mysql_query("INSERT INTO users VALUES('','$name','$lastname')");
        }

        }
        ?>
        <form name="registration" action="registration.php" method="post">
        <?php if($error): ?>
        <div style="color:#FF0000"><?php echo $error?></div>
        <?php endif; ?>
        Name: <input type="text" name="name" /><br />
        Lastname: <input type="text" name="lastname" />
        <input type="submit" name="send" value="register" />
        </form>
        ----------------------------------

        You should validate your data in the server, not only with javascript.
        If you need further help with it, feel free to post your code so i can test
        it ;).

        Regards,


        On 10/3/06, Michael Pakay - www.NJCGL.com League Coordinator <
        pakaymc@...> wrote:
        >
        > Actually I'm performing data checking. Making sure a user fills in all
        > required fields. My problem is this. When JavaScript is enabled and a
        > user does not fill in a required field, the JavaScript function will
        > warn the user and disable the button to append to the database. If
        > JavaScript is disabled, the database will be appended with potentially
        > useless information.I am in the process of redesigning my menus using
        > code from www.Milonic.com. This will disable my menu if JavaScript is
        > not enabled which will stop all database appends. Unfortunately this
        > will also render my site useless without JavaScript.
        >
        > I also tried
        > <noscript><meta http-equiv="refresh"
        > content="0;url=http://www.your-site.com/EnableJavaScript.html
        > <http://www.your-site.com/EnableJavaScript.html>"></noscript>
        > This works well in FireFox but produces an error with IE.
        >
        > Any ideas will be appreciated.
        >
        > m
        >
        > David Smart wrote:
        > >
        > > Are you saying that you are using JavaScript to validate data before
        > using
        > > it on your server (e.g. to put it in a database)? Don't. There are
        > always
        > > ways to circumvent this and the unscrupulous will do nasty things.
        > >
        > > Proper data validation (for your protection) MUST be done on your
        > server.
        > >
        > > You can do data checking on the browser too (for the user) by all
        > > means. It
        > > is quicker and users will prefer it.
        > >
        > > Regards, Dave S
        > >
        > > ----- Original Message -----
        > > From: "Michael Pakay" <pakaymc@... <pakaymc%40gmail.com> <mailto:
        > pakaymc% <pakaymc%25>40gmail.com>>
        > > To: <JavaScript_Official@yahoogroups.com<JavaScript_Official%40yahoogroups.com>
        > > <mailto:JavaScript_Official%40yahoogroups.com>>
        > > Sent: Tuesday, October 03, 2006 3:10 AM
        > > Subject: [JavaScript] <noscript></noscript> Page redirect
        > >
        > > >I use JavaScript on my site for data validation. If a user turns off
        > > > JavaScript data verification is also turned off. I use the
        > > > <noscript></noscript> in the body to request that the user turn on
        > > > JavaScript but this does not help with data verification.
        > > >
        > > > Can I redirect a user to a page, EnableJavaScript.html with in
        > > > <noscript></noscript>? This will give me the opportunity to give full
        > > > directions on how to enable JS and give a full explanation on the
        > > > advantages of JS for my site.
        > > >
        > > >
        > > > TIA
        > > >
        > > > Michael Pakay
        > > >
        > > > pakaymc@... <pakaymc%40gmail.com> <mailto:pakaymc% <pakaymc%25>
        > 40gmail.com>
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > > > Visit http://aiaiai.com <http://aiaiai.com> for more groups to join
        > > > Yahoo! Groups Links
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > >
        > >
        >
        >
        >



        --
        Ernesto


        [Non-text portions of this message have been removed]
      • David Smart
        That s why I made the distinction I did. You must VALIDATE the data - on the server - before putting it in the database. If the user has not provided a
        Message 3 of 10 , Oct 4, 2006
        • 0 Attachment
          That's why I made the distinction I did. You must VALIDATE the data - on
          the server - before putting it in the database. If the user has not
          provided a required field, simply bounce back to an error page. (You can
          also choose to CHECK the data - on the client - so that user errors will be
          reported without needing a round trip to the server to find out.)

          You don't need to be too "nice" about server side validation errors, either
          (e.g. trying to keep track of what they actually got right and pre-populate
          a new data entry screen). People who choose not to have JavaScript enabled
          are used to losing user assistance. Simply tell them on the error page that
          it would all work better with JavaScript enabled, then provide a link to go
          to a new copy of the data entry page, where they can start from scratch.

          If you stop your site from working without JavaScript enabled, then you will
          lose the people who choose to turn JavaScript off.

          Regards, Dave S

          ----- Original Message -----
          From: "Michael Pakay - www.NJCGL.com League Coordinator" <pakaymc@...>
          To: <JavaScript_Official@yahoogroups.com>
          Sent: Wednesday, October 04, 2006 11:00 AM
          Subject: Re: [JavaScript] <noscript></noscript> Page redirect


          > Actually I'm performing data checking. Making sure a user fills in all
          > required fields. My problem is this. When JavaScript is enabled and a
          > user does not fill in a required field, the JavaScript function will
          > warn the user and disable the button to append to the database. If
          > JavaScript is disabled, the database will be appended with potentially
          > useless information.I am in the process of redesigning my menus using
          > code from www.Milonic.com. This will disable my menu if JavaScript is
          > not enabled which will stop all database appends. Unfortunately this
          > will also render my site useless without JavaScript.
          >
          > I also tried
          > <noscript><meta http-equiv="refresh"
          > content="0;url=http://www.your-site.com/EnableJavaScript.html
          > <http://www.your-site.com/EnableJavaScript.html>"></noscript>
          > This works well in FireFox but produces an error with IE.
          >
          > Any ideas will be appreciated.
          >
          > m
          >
          > David Smart wrote:
          >>
          >> Are you saying that you are using JavaScript to validate data before
          >> using
          >> it on your server (e.g. to put it in a database)? Don't. There are always
          >> ways to circumvent this and the unscrupulous will do nasty things.
          >>
          >> Proper data validation (for your protection) MUST be done on your server.
          >>
          >> You can do data checking on the browser too (for the user) by all
          >> means. It
          >> is quicker and users will prefer it.
          >>
          >> Regards, Dave S
          >>
          >> ----- Original Message -----
          >> From: "Michael Pakay" <pakaymc@... <mailto:pakaymc%40gmail.com>>
          >> To: <JavaScript_Official@yahoogroups.com
          >> <mailto:JavaScript_Official%40yahoogroups.com>>
          >> Sent: Tuesday, October 03, 2006 3:10 AM
          >> Subject: [JavaScript] <noscript></noscript> Page redirect
          >>
          >> >I use JavaScript on my site for data validation. If a user turns off
          >> > JavaScript data verification is also turned off. I use the
          >> > <noscript></noscript> in the body to request that the user turn on
          >> > JavaScript but this does not help with data verification.
          >> >
          >> > Can I redirect a user to a page, EnableJavaScript.html with in
          >> > <noscript></noscript>? This will give me the opportunity to give full
          >> > directions on how to enable JS and give a full explanation on the
          >> > advantages of JS for my site.
          >> >
          >> >
          >> > TIA
          >> >
          >> > Michael Pakay
          >> >
          >> > pakaymc@... <mailto:pakaymc%40gmail.com>
          >> >
          >> >
          >> >
          >> >
          >> >
          >> >
          >> >
          >> >
          >> > Visit http://aiaiai.com <http://aiaiai.com> for more groups to join
          >> > Yahoo! Groups Links
          >> >
          >> >
          >> >
          >> >
          >> >
          >> >
          >> >
          >> >
          >> >
          >> >
          >>
          >>
          >
          >
          >
          >
          >
          > Visit http://aiaiai.com for more groups to join
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
        • Jonas Raoni
          ... Right, the web development isn t restricted to the web browsers we re used to see. There are so many devices ^^ -- Jonas Raoni Soares Silva
          Message 4 of 10 , Oct 4, 2006
          • 0 Attachment
            On 10/4/06, David Smart <smartware@...> wrote:
            > If you stop your site from working without JavaScript enabled, then you will
            > lose the people who choose to turn JavaScript off.

            Right, the web development isn't restricted to the web browsers we're
            used to see. There are so many devices ^^


            --
            Jonas Raoni Soares Silva
            http://www.jsfromhell.com
          • Michael Pakay - www.NJCGL.com League Coo
            Thank you David & Ernesto. I will add data checking on my php page as well as with the current JavaScript code. My original thought was to validate the data
            Message 5 of 10 , Oct 4, 2006
            • 0 Attachment
              Thank you David & Ernesto.

              I will add data checking on my php page as well as with the current
              JavaScript code. My original thought was to validate the data input
              prior to php. This obviously was not the best. In my php page if the
              data is not valid I will let the user know and redirect them back to the
              data import form.

              I will also do some reading on mysql_real_escape_string. I have not used
              this in the past.

              Thank you again for your help.

              m




              Ernesto Mendoza Blanco wrote:
              >
              > Form validation is easy with php, take this as an example:
              >
              > registration.php-----------
              > <?php
              > if($_POST['send']){
              > $error = false;
              > $name = mysql_real_escape_string($_POST['name']); //always escape your
              > vars
              > $lastname = mysql_real_escape_string($_POST['lastname']);
              > if( empty($name) && empty($lastname) ){
              > $error = 'Form incomplete!!';
              > }else{
              > mysql_query("INSERT INTO users VALUES('','$name','$lastname')");
              > }
              >
              > }
              > ?>
              > <form name="registration" action="registration.php" method="post">
              > <?php if($error): ?>
              > <div style="color:#FF0000"><?php echo $error?></div>
              > <?php endif; ?>
              > Name: <input type="text" name="name" /><br />
              > Lastname: <input type="text" name="lastname" />
              > <input type="submit" name="send" value="register" />
              > </form>
              > ----------------------------------
              >
              > You should validate your data in the server, not only with javascript.
              > If you need further help with it, feel free to post your code so i can
              > test
              > it ;).
              >
              > Regards,
              >
              > On 10/3/06, Michael Pakay - www.NJCGL.com League Coordinator <
              > pakaymc@... <mailto:pakaymc%40gmail.com>> wrote:
              > >
              > > Actually I'm performing data checking. Making sure a user fills in all
              > > required fields. My problem is this. When JavaScript is enabled and a
              > > user does not fill in a required field, the JavaScript function will
              > > warn the user and disable the button to append to the database. If
              > > JavaScript is disabled, the database will be appended with potentially
              > > useless information.I am in the process of redesigning my menus using
              > > code from www.Milonic.com. This will disable my menu if JavaScript is
              > > not enabled which will stop all database appends. Unfortunately this
              > > will also render my site useless without JavaScript.
              > >
              > > I also tried
              > > <noscript><meta http-equiv="refresh"
              > > content="0;url=http://www.your-site.com/EnableJavaScript.html
              > <http://www.your-site.com/EnableJavaScript.html>
              > > <http://www.your-site.com/EnableJavaScript.html
              > <http://www.your-site.com/EnableJavaScript.html>>"></noscript>
              > > This works well in FireFox but produces an error with IE.
              > >
              > > Any ideas will be appreciated.
              > >
              > > m
              > >
              > > David Smart wrote:
              > > >
              > > > Are you saying that you are using JavaScript to validate data before
              > > using
              > > > it on your server (e.g. to put it in a database)? Don't. There are
              > > always
              > > > ways to circumvent this and the unscrupulous will do nasty things.
              > > >
              > > > Proper data validation (for your protection) MUST be done on your
              > > server.
              > > >
              > > > You can do data checking on the browser too (for the user) by all
              > > > means. It
              > > > is quicker and users will prefer it.
              > > >
              > > > Regards, Dave S
              > > >
              > > > ----- Original Message -----
              > > > From: "Michael Pakay" <pakaymc@...
              > <mailto:pakaymc%40gmail.com> <pakaymc%40gmail.com> <mailto:
              > > pakaymc% <pakaymc%25>40gmail.com>>
              > > > To: <JavaScript_Official@yahoogroups.com
              > <mailto:JavaScript_Official%40yahoogroups.com><JavaScript_Official%40yahoogroups.com>
              > > > <mailto:JavaScript_Official%40yahoogroups.com>>
              > > > Sent: Tuesday, October 03, 2006 3:10 AM
              > > > Subject: [JavaScript] <noscript></noscript> Page redirect
              > > >
              > > > >I use JavaScript on my site for data validation. If a user turns off
              > > > > JavaScript data verification is also turned off. I use the
              > > > > <noscript></noscript> in the body to request that the user turn on
              > > > > JavaScript but this does not help with data verification.
              > > > >
              > > > > Can I redirect a user to a page, EnableJavaScript.html with in
              > > > > <noscript></noscript>? This will give me the opportunity to give
              > full
              > > > > directions on how to enable JS and give a full explanation on the
              > > > > advantages of JS for my site.
              > > > >
              > > > >
              > > > > TIA
              > > > >
              > > > > Michael Pakay
              > > > >
              > > > > pakaymc@... <mailto:pakaymc%40gmail.com>
              > <pakaymc%40gmail.com> <mailto:pakaymc% <pakaymc%25>
              > > 40gmail.com>
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > > Visit http://aiaiai.com <http://aiaiai.com> <http://aiaiai.com
              > <http://aiaiai.com>> for more groups to join
              > > > > Yahoo! Groups Links
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > >
              > > >
              > >
              > >
              > >
              >
              > --
              > Ernesto
              >
              > [Non-text portions of this message have been removed]
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.