Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 23, 2012, 04:23:09 PM

Pages: [1]   Go Down
  Print  
Author Topic: calling a url to process a form inside a function  (Read 5519 times)
durangod
Galactic Royalty
*****
Offline Offline

Posts: 203


« on: March 14, 2010, 06:00:59 PM »

hi basically i bought some software that im trying to fix to work on my own so sorry for all the questions (i dont want to loose my investment ya know)

so i need some javascript help

i need to be able to call a process page in an if statement of a function

such as

function checkit ()

if this is not right format then error out

else

go to this process url page and process the form and then come back true

i have the old form set up and the form works but it does not check the form imput,  i have a function that i can run to check the form input but then i need it to go process the change if all is ok..


so what exactly is the syntax format and execute function for a url in javascript, i have been reading and testing for 4 hours now and i just cant get it..  here is what i have so far


by the way i know i can put this url in the action, the problem is that the action process page does not check for bad format and i have to seperate this part from that part, so it has to be done seperately.


here is the function i have writen and learned so far

Code:
<script type="text/javascript">
<!--
var processchangeUrl= "<?php echo $CONST_LINK_ROOT?>/complete_register.php<?php print("?PHPSESSID=".session_id()); ?>&mode=update&user_id=<?=$Sess_UserId?>";

function show_alert()

{
  if (document.FrmRegister.txtEmail.value.indexOf("@") == -1)
                       {
                   alert("<?=addslashes(INVALID_EMAIL)?>");
                   document.FrmRegister.txtEmail.focus();
                   return (false);
                         }

 else
                    {
               window.location="(processchangeUrl)";
               return(true):
                        }


}

// -->


as you can see im trying to use the var in the else statement but i cant so how do i lay this out please help thanks


UPDATE ok i think i have my brain wrapped around this i found another process to do this but i am still wondering that the syntax for ths is.   
« Last Edit: March 14, 2010, 10:26:55 PM by durangod » Logged
Pages: [1]   Go Up
  Print  
 
Jump to: