[pmwiki-users] How to get the value of a text field form before posting ?

Peter Kay pkay42 at gmail.com
Wed Jul 27 13:34:59 CDT 2016


Yes.

A few points:

* Any processing done client side is (by default) going to be javascript.
* Don't trust client-side processing.  Someone WILL screw things up,
turn off javascript, have weird settings etc.  So by all means do it,
but also check server-side (i.e., php after the action handler picks
it up) because you can't trust client-side.
* You might as well have "No answer" or something like that in
addition to "Mr" and "Mrs"
* Be aware there is no security on a password field - it's still plain
text for the world to see unless you're doing https.

Javascript's not impossible to work with, and there are some good
beginner sites out there (there are fewer intermediate sites, but
that's the way it goes :p )  You can probably get a good idea how
people are handling such things by looking at code.  Even some of the
cookbook recipes would be quite instructional.

HTH,

--Peter




On Wed, Jul 27, 2016 at 12:46 PM, Patrice PELLE <patrice-pelle at bbox.fr> wrote:
> Hi,
>
> to answer your question, I can’t assess my knowledge. To put it with my
> words and my understanding :
>
> i would like to display a form to be filled , I think client side
> I would like to make a first processing of some data, at the input time. The
> purpose of this treatment is, for example,
>
> to give specific information depending on the input, to help the person
> filling the form to understand what he is doing. A very basic example :
> display either « Mr» or "Mrs «  depending on the check of a radio button,
> to check some input property to be sure that the input is valid. A basic
> example would be to check the length of a password. In my opinion, it’s no
> need to send improper data to the server.
>
> I think this should still be client side.
>
> When the form is filled, the user click the submit button, and the valid
> data are processed on the server (for example storage in some file server
> side). Globally, this last part seems to work. I get some difficulties due
> to typing error, « (,{«  mismatch, « ; » forgotten or extra. Just being
> patient
>
> Does it answer your baseline question ?
>
> Thanks
>
> Patrice
>
>
>
> Le 27 juil. 2016 à 18:27, Peter Kay <pkay42 at gmail.com> a écrit :
>
> Let me ask you baseline question:  how well do you understand the
> client/server nature of webpages?
>
> Which relates directly to the question: what exactly do you want each
> one of them to be doing with the form?
>
> --Peter
>
>
> On Wed, Jul 27, 2016 at 8:52 AM, Patrice PELLE <patrice-pelle at bbox.fr>
> wrote:
>
>
> Hello,
>
> I am a true beginner in PHP and HTML. I am trying to make a form that I hope
> will someday end up in a cookbook.
>
> In the following test form, I would like to get the value of the input text
> before posting :
>
> <!DOCTYPE html>
> <html lang=fr>
>
> <head>
> <title>Test</title>
> <meta charset = "UTF-8">
>
> </head>
>
>
> <body>
> <form action = "<?php echo $_SERVER["PHP_SELF"];?>" method = post >
>
> Admin Password : <input type="password" name = "AdminMdP" style="width:
> 20em;" required  >
>
> How to get here the value of AdminMdP to make some PHP treatment
> (suffiscient length, special characters,…), any time the value is changed ?
>
> <input type="submit"  name ="OkButton" value = "Enter">
> </form>
> </body>
>
> <?php
>
> if (isset($_POST['OkButton']))
> {
>    $AdminMdP = $_POST["AdminMdP"];
>    echo $AdminMdP;
> }
> ?>
>
> I  looked for some answers in the internet, but examples in jQuery, AJAX,
> JavaScript are useless for me. They suppose you know what it means, which is
> quite not my case. I told you, I’m a true beginner :)
>
>
> Thanks for your help
>
>
> Patrice
> patrice-pelle at bbox.fr
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>
>
>



More information about the pmwiki-users mailing list