Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Design and Graphics Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-28-2009, 05:40 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Can I have java script in my templete or does it have to reside outside the templete

Please look at this my calendarjump templete and have modifyed the one that comes out of the box.

I plan to add more logic to my java script function first i got to get the basic stuff to work first.

Can someone give me a idea why or what i am doing wrong when the user press the "Go" button nothing happens and it should it least go select another calandar.

Please review what i have posted below and let me know what i am doing wrong a example of what it should look like would help me greatly.

PHP Code:

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

        
this.form.submit();

}

</
script>

<
form action="calendar.php" method="get">

<
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="
button" value="Go" onclick="process_selected(this.form)" <br />

     </div>

</form> 
THANKS

Frank H. Shaw
Reply With Quote
  #2  
Old 02-28-2009, 07:28 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You may have javascript in your templates. But, isn't on.form.submit() just a basic javascript call that you can do on an onchange? Do you need a function for it?
Reply With Quote
  #3  
Old 02-28-2009, 07:50 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have to some how get my java script function to work with my form so that when a event happens in the form my java script function will process what was selected.

A function or example would help since you offered THANKS

The other thing is the problem is the c value in the this.form.onsubmit(); in the select as the product came unmodifyed by me has a great deal to do with the selection of the calandar from the dropdown calendarjumo.

I have been doing a lot of testing and playing with a number of ways and at some point before leaving the dropdown the value needs to be set to c and not some otehr value which i tried.

I do not know where in the vbulletin product the actual logic is to do all this.

I did in my playing around realize that i could change the value from c to y and z and it would show up on the adress bar of the browser as a get for those items selected so somewhere in the logic in vbullettin the logic over writes what was selected in the dropdown and only a value of c will the actual navbar show the correct calendar selected.

I do not know if you can also shed some light on to what is happening and where this logic could be located.

Now can you explain what events are supprted in the java script and how to get the two to handshake.

THANKS

Frank H. Shaw

--------------- Added [DATE]1235858101[/DATE] at [TIME]1235858101[/TIME] ---------------

Quote:
Originally Posted by Lynne View Post
You may have javascript in your templates. But, isn't on.form.submit() just a basic javascript call that you can do on an onchange? Do you need a function for it?
THANKS Lynne

You say the on.form.submit() and only the onchange event is supported what about the onclick event etc.

Which ones are supported and which ones are not?

--------------- Added [DATE]1235864581[/DATE] at [TIME]1235864581[/TIME] ---------------

I realizied that my java script weather it is needed or not I added the function in my java script but that still did not solve the problem - I still not getting the handshaking bettween my form and the java script.

A good example of how I have to do it inside the templete would help and a little explianation also would help why my handshakeing is not working.

THANKS

Frank H. Shaw
Reply With Quote
  #4  
Old 02-28-2009, 09:49 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, I don't write javascript, so I can't give any examples. I just know that looking through the vb templates always shows onchange="on.form.submit()" when it is used.
Reply With Quote
  #5  
Old 02-28-2009, 10:25 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I will try that and see if that makes a difference?

Mybe someone else seeing the post might have more understand of java script and help me through it.

I will let you know if it works or does not

THANKS

Frank H. Shaw

--------------- Added [DATE]1235867361[/DATE] at [TIME]1235867361[/TIME] ---------------

Quote:
Originally Posted by Frank H. Shaw View Post
I will try that and see if that makes a difference?

Mybe someone else seeing the post might have more understand of java script and help me through it.

I will let you know if it works or does not

THANKS

Frank H. Shaw

Nope still does not work - can someone help me with the handshaking bettween my form and java script.

THANKS

Frank H. Shaw

--------------- Added [DATE]1235873445[/DATE] at [TIME]1235873445[/TIME] ---------------

I need to tell if my java script is being called now that my leastest version of my templete i now get my selection in the dropdown to actual display the correct calendar the one selected by the user in the drop down.

Here is the working copy you can see the changes i had to make!

PHP Code:

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

             
on.form.submit();

}

</
script>

<
form action="calendar.php" method="get">

<
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]" onclick="process_selected(this.form)" <br />

     </div>

</form> 


Ok The above works but how can i debug my java script so that I know it is being called without have header output errors which would happen if i just do a echo someone must have a trick that i can use.

I could do a echo and then exit but that will not really helo if i want to keep the web page coming up and if i use the echo the web page will over write my echo?

THANKS

Frank H. Shaw
Reply With Quote
  #6  
Old 03-01-2009, 06:55 AM
vbplusme vbplusme is offline
 
Join Date: Sep 2008
Location: CyberSpace
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:

Ok The above works but how can i debug my java script so that I know it is being called without have header output errors which would happen if i just do a echo someone must have a trick that i can use.

I could do a echo and then exit but that will not really helo if i want to keep the web page coming up and if i use the echo the web page will over write my echo?

THANKS

Frank H. Shaw
Use firefox debugging tools/plugins, javascript debugger
Reply With Quote
  #7  
Old 03-01-2009, 12:58 PM
Frank H. Shaw Frank H. Shaw is offline
 
Join Date: Aug 2007
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by vbplusme View Post
Use firefox debugging tools/plugins, javascript debugger
I am sorry I should have been a little clearer then what i am asking - Is there a general output / debuging function that is built in to vbulttin that I should be using to debug my scripts.

Up to this point ot has not been a problem to work around the issues of debugging but now that I am going to be getting my java function to be called from my form and still testing that to see of the handshaking is there or not.

What I do know so far is the following is key to bring up the correct calandar when selected from the drop down.

That is this:

PHP Code:

<input type="submit" class="button" value="$vbphrase[go]onclick="process_selected(this.form)" <br /> 
And the following is the key so there is some logic in the calandar.php or functions_calendar.php or some where else in the vbulletin system where ever that maybe.

It seems a lot of logic is built around this
PHP Code:
  value="$vbphrase[go]
and so i will have to go through the scripts looking for that logic maybe this with some luck i will find the logic this time.

THANKS

Frank H. Shaw

--------------- Added [DATE]1235920034[/DATE] at [TIME]1235920034[/TIME] ---------------

It still is not working my java function never gets called WHY?

Please explain WHY?

I have finshed my testing and do not see that my java function is getting called so what is wrong with the handshaking the calling of my java function from the onclick event is the onclick event not supported.

I need to some how have my java function called before submiting the form in a get - please again review my posting and see what needs to change? THANKS

THANKS

Frank H. Shaw

--------------- Added [DATE]1235955488[/DATE] at [TIME]1235955488[/TIME] ---------------

The handshaking is now working just fine and I should have a few other issues around this but at least my form is now calling my javascript function.

THE FOLLOWING WORKS:


PHP Code:

<script type="text/javascript"> function process_selected(form) {
                        
             
alert('This is working!');
             
             
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> 
The reason that it needs to happen this way is the following:

The 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.

Then the function will accept a variable and assign it the name form, and then it will submit it (form.submit()).

THANKS

Frank H. Shaw
Reply With Quote
  #8  
Old 03-02-2009, 11:16 AM
mmoore5553 mmoore5553 is offline
 
Join Date: Aug 2008
Posts: 530
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i always find it easier to pull my javascript from external file and then use a plugin that is in global start for it to function. Just so it is seperate and you can find the issues quicker and you use just a variable where you need to add it .
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:09 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04080 seconds
  • Memory Usage 2,292KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete