|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
can you do this?
im assuming you can but im not sure and i can't seem to get it to work but i want the aciton of a form to go to a function that checks it for completeness.
action="checkForm()" checkForm() { if ($isset($var)) : ... } something to that effect... |
|
#2
|
|||
|
|||
|
the action command inside a form tag is client side and the function is php, so you cant actually do that
|
|
#3
|
|||
|
|||
|
I guess what you're trying to do is to check the validity of a form BEFORE sending it to the server side.
For that, you can use some javascript i.e. : function checkItOut() { whatever statement; if (notVerified) return false; else return true; } And validate the form before it gets sent to the server i.e. : <form onSubmit="return checkItOut();"> ciao! |
|
#4
|
|||
|
|||
|
what about action="<? checkForm() ?>"????
|
|
#5
|
|||
|
|||
|
Nop!
you cannot do <form action="<? action() ?>"> It is not on the same side of the network. The form tag is processed by the browser (client side) and the <? action() ?> is processed on the server side. Actually, you COULD write <form action="<? action() ?>"> but the result will not be as expected (the action() function will not validate the form). It will only put nothing in the action tag. So the browser will parse <form action=""> and send the whole form to the curent page (but to the server.) But maybe you would like to try passing a hidden form field to the script you're calling (if action="" => curent page script) with the function name (i.e. <input type="hidden" name="funct" value="action"). And then, in the script that receive that form, you could call the desired function with something similar to : $funcName = $HTTP_POST_VARS["funct"]; if (function_exists($funcName)) $funcName(); hope that will help ! ciao! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > can you do this? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|