[parenscript-devel] Parenscript onsubmit="return validate()"

Vladimir Sedach vsedach at gmail.com
Sun Jul 29 18:55:37 UTC 2012


Hi Juan,

That code has two problems:

(ps (validate)
     (defun validate () ...))

is in the onsubmit handler. So you're calling validate before it's
defined, but you also should not be defining functions in those
handlers.

I have no idea how UCW organizes code, but function definitions should
go somewhere else (probably a javascript file).

(ps (return (validate))) will produce the right result for use in an
inline handler - "return foo();" - but you should think about using a
JavaScript event handling library if you're going to be doing anything
non-trivial with event handlers.

Vladimir

On Tue, Jun 5, 2012 at 7:54 PM, Juan Reynoso Elias
<jreynoso666 at gmail.com> wrote:
> Hello
> I work with parenscript and UCW, I need validate some input text and  I have
> control the submit of the  form.
>
> Here use parenscript, it's a code for my function "validate"
>
>  ( setf xvalue document.form1.mac.value )
>                                        (setf result ((@(regex
> "/([A-Fa-f0-9]{2,2}:{1}){5}([A-Fa-f0-9]{2})$/") test) xvalue ))
>                                        (if (eql F result )
>                                        ((alert "Fail")
>                                         (setf
> document.form1.mac.style.background-color "red")
>                                         F ) ; ==> javascript  return false;
>                                        (alert "Ok")
>                                        T)) ; ==> javascript  return true;
>
> Html code , called function validate
> <form id="form1"  onsubmit="return validate();"  >   Here, I have a
> question, How I do same with parenscript  >> "return validate();"
>
> (<ucw:form :name "form1"
> :onsubmit
> (ps (validate) ; Here I have a problem  >>   "return validate();"
>      (defun validate ()
>        ( setf xvalue document.form1.mac.value )
>        (setf result ((@(regex
> "/([A-Fa-f0-9]{2,2}:{1}){5}([A-Fa-f0-9]{2})$/") test) xvalue ))
>        (if (eql F result )
>          ((alert "Fail")
>          (setf document.form1.mac.style.background-color "red")
>             F ) ; ==> javascript  return false;
>         (alert "Ok")
>        T))) ; ==> javascript  return true;
>
>
>
>
>
>
>
>
> --
> I.S.C.  Juan Reynoso Elias
>
> Departamento de Soporte Técnico del Instituto de la Función  Registral del
> Estado de México.
> Vicente Guerrero 102, Col Santa Ana Tlapaltitlán, Toluca, Méx. C.P. 50160.
> Tel. 2106852.
>
>
>
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>




More information about the parenscript-devel mailing list