Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: My form does not seem to call me javascript WHY

  1. #1
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default My form does not seem to call me javascript WHY

    My strength is not java script and with the complex issues of dealing with the Vbulletin interface and then the java script which i do not really understand yet fully I hopeing some good soul will come to my add fast and get me through this.

    I do not expect that I will find someone that has the knowelage of vbulletin but I need to be correct java script first but if someone knows Vbulletin i modifyed the calendar_jump which is calendarjump in the templete system.

    Here goes the problem is my form is not calling up my java script - even allought the java is not doing anything right now I have dump some idea of what i want to do inside it for clearlty to my idea what i am trying to do!

    The point is I need my java script function "process_selected(this.form)" to be called before the submitting of the form in the form of a $_GET to the server.





    PHP Code:

    <script type="text/javascript"> function process_selected(form) {

                 
    alert('This is working!');

                 
    form.submit();

    }

    </script>
     
    <form name="myform" action="calendar.php" method="get" onsubmit="process_selected(this)" >

    <div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap">

                <input type="hidden" name="s" value="$session[sessionhash]" />

                <input type="hidden" name="month" value="$month" />

                <input type="hidden" name="year" value="$year" />

                <input type="hidden" name="do" value="$docalendar" />

            <strong>$vbphrase[Lodge_Calendar]</strong><br />

            <select name="c" >

                    <optgroup label="$vbphrase[please_select_one]">

                       $jumpcalendarbitsl

                    </optgroup>

            <input type="hidden" name="me" value='2'" />

            </select>

              <input type="submit" class="button" value="$vbphrase[go]" > <br />

         </div>

    </form> 

    Please review the posting above and tell me what i am doing wrong to have the handshaking between my form and the java script WHY IS IT NOT BEING CALLED.

    THANKS

    Frank H. Shaw
    Last edited by fshaw; 03-02-2009 at 12:40 AM.

  2. #2
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    Code:
    <script type="text/javascript"> function process_selected(this.form) { 
    
                 on.form.submit(); 
    
    } 
    
    </script>
    try changing both highlighted to a single variable, for instance form:
    Code:
    <script type="text/javascript"> function process_selected(form) { 
    
                 form.submit(); 
    
    } 
    
    </script>
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  3. #3
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I went in and edited my orginal post some and still does not work WHY

    the here is the two places i changed

    PHP Code:

    <form name="myform" action="calendar.php" method="get"

    and

    PHP Code:

    input type
    ="submit" class="button" value="$vbphrase[go]"  onclick="process_selected(this.form)" > <br /> 
    But please explain how the javascript function works

    I am going to call a php function from within my javascript function once i get the handshaking to happen.

    THANKS

    Frank H. Shaw

  4. #4
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    you have to add the code to the form: <form name="myform" action="calendar.php" method="get" onsubmit="process_selected(this)">. So when the form is submitted (onsubmit) , the function process_selected will be run and it will pass a pointer to the form (this) as a variable.
    The function will accept a variable and assign it the name form, and then it will submit it (form.submit()).
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  5. #5
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Again I edited the orginal post to be this is this correct so far?

    Quote Originally Posted by Master_script_maker View Post
    you have to add the code to the form: <form name="myform" action="calendar.php" method="get" onsubmit="process_selected(this)">. So when the form is submitted (onsubmit) , the function process_selected will be run and it will pass a pointer to the form (this) as a variable.
    The function will accept a variable and assign it the name form, and then it will submit it (form.submit()).

    Please review my orginal post and see if i have it correct now?

    Does the line below stay or change?

    PHP Code:

     
    <input type="submit" class="button" value="$vbphrase[go]onclick="process_selected(this.form)" > <br /> 
    THANKS

    Frank H. Shaw

  6. #6
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    you would change
    HTML Code:
     <input type="submit" class="button" value="$vbphrase[go]" onclick="process_selected(this.form)" > <br />
    to
    Code:
     <input type="submit" class="button" value="$vbphrase[go]"> <br />
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  7. #7
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ok now i have this working I want to use my java script call

    My alert is now working so the handshaking is happening now half way home now THANKS.

    As before i changed the above orginal post to reflex the changes in my posting.

    Here is what I want to do is I want my java script to call a function outside the templete but located in some php file in the same domain on the server so let me explain that later!

    But first I need to know can I pass the value of my hidden input field to my javascript function please give me a example THANKS?

    Here is what i mean?

    PHP Code:

    <input type="hidden" name="me" value='2'" /> 
    I want my java function have access to my "me" is there a way to do that?

    THANKS

    Frank H. Shaw

  8. #8
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    in the function you would use: form[name] so form["me"], and if you want to access its value: form["me"].value
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  9. #9
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help you lost me on what you said

    Quote Originally Posted by Master_script_maker View Post
    in the function you would use: form[name] so form["me"], and if you want to access its value: form["me"].value
    I need a better explaination on what you are trying to tell me a example would help - I am sorry this is kind new to me the javascript stuff so I am a little slow!

    Do I make the change in my form or in my javascript or both?

    THANKS

    Frank H. Shaw

  10. #10
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Here is some of what I think you mean?

    Do you mean this?

    PHP Code:

    <script type="text/javascript"> function process_selected(form["me"]) {
                            
                 
    alert('This is working!');

                 
    $me form["me"].value;
                 
                 
    form.submit();
    }
    </script>


    <form name="myfrom" action="calendar.php" method="get" onsubmit="process_selected(this)" >
    <div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap">
        <input type="hidden" name="s" value="$session[sessionhash]" />
        <input type="hidden" name="month" value="$month" />
        <input type="hidden" name="year" value="$year" />
        <input type="hidden" name="do" value="$docalendar" />
            <strong>$vbphrase[Lodge_Calendar]</strong><br />
            <select name="c" >
                    <optgroup label="$vbphrase[please_select_one]">
                       $jumpcalendarbitsl
                    </optgroup>
            <input type="hidden" name="me" value='2'" />
            </select>
              <input type="submit" class="button" value="$vbphrase[go]" > <br />
         </div>
    </form> 

    If the javascript is correct what has to change in the form its self if anything?

    THANKS

    Frank H. Shaw

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •