Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Two authboxes causing javascript error

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-13-2005, 06:56 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default Two authboxes causing javascript error

OK, experimenting with two authentication boxes (authbox.tpl) on the page, but the strange thing is that when I click the "Logoff" text next to the "Go" button, it results in a javascript error "Object does not support this method". Alternatively, if I click the "Go" button it does actually logoff. This behaviour only happens when the two authboxes are present on the page.

I've seen this mentioned once before on the forum but no solution or reason as to why it happens. The button code on the authbox is (which I gather is default X-Cart):

Code:
{if $js_enabled} {include file="buttons/logout_menu.tpl"} {else} {include file="buttons/logout_menu.tpl"} {/if}

and the button/logout_menu.tpl is:

Code:
<FONT class="VertMenuItems">{$lng.lbl_logoff} </FONT><INPUT type="image" { include file="buttons/go_image_menu.tpl" }>

Any ideas?

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #2  
Old 10-13-2005, 08:09 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

Worked it out. X-Cart/Javascript doesn't seem to like the two forms having the same name. I've made a second (copied) authbox.tpl and changed the "name" of the form from:
Code:
<FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform">

to:

Code:
<FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform2">

then I updated the a href tag of the button to reference this form:


I now have the original authbox.tpl on the side menu and the doctored authbox.tpl (authbox_mod.tpl) within the page. It now logs off regardless of what's pressed!

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #3  
Old 06-19-2006, 09:04 PM
 
rcg rcg is offline
 

Member
  
Join Date: Mar 2005
Posts: 18
 

Default

I'm getting errors on this topic... I created a "Your Account" page which can display the login so I end up with 2 login boxes (one on the menu left and the "account" page I created).

I'm clear about the first part of your mod but where do I modify the button hyperlink you reference in the last entry of your mod?

My issue is login in only not logout. I only display one logout button on the side menu.

Thanks
__________________
X-Cart GOLD 4.0.17
Affiliate
RMA
AOM
Configurator
---
PHP 4.4.2
MYSQL 4.1.21
Reply With Quote
  #4  
Old 06-19-2006, 11:31 PM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

Hi,

In my modified auhtbox (authbox_mod.tpl) I have:

Code:
{if $js_enabled} {include file="buttons/button.tpl" style="button" button_title=$lng.lbl_logoff href="javascript:document.loginform2.submit()"} {else} {include file="buttons/logout_menu.tpl" style="button" href="javascript:document.loginform2.submit()"} {/if}

which is the button code.

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #5  
Old 06-20-2006, 07:01 AM
 
rcg rcg is offline
 

Member
  
Join Date: Mar 2005
Posts: 18
 

Default

so you are adding the above code or modifying the existing code? Here is my version as of right now.



Code:
{* $Id: authbox_mod.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *} {capture name=menu} <TABLE border="0" cellpadding="0" cellspacing="0" width="100%"> <FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform"> <tr> <TD width="1%"></TD> <TD width="99%"> <font color="#333333" size="4">{$login}{$lng.txt_logged_in}</font> </TD> </tr> {if $usertype eq "C"} {/if} <INPUT type="hidden" name="mode" value="logout"> <INPUT type="hidden" name="redirect" value="{$redirect}"> </FORM> </TABLE> {/capture} {include file="menu_mod.tpl" menu_title=$lng.lbl_authentication menu_content=$smarty.capture.menu}
__________________
X-Cart GOLD 4.0.17
Affiliate
RMA
AOM
Configurator
---
PHP 4.4.2
MYSQL 4.1.21
Reply With Quote
  #6  
Old 06-20-2006, 07:21 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

My opening form tag is:

Code:
<FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform2">

and then the bottom of my file looks like:

Code:
{if $user_subscription ne ""} {include file="modules/Subscriptions/subscriptions_menu.tpl"}</a> {/if} {/if} {if $js_enabled} {include file="buttons/button.tpl" style="button" button_title=$lng.lbl_logoff href="javascript:document.loginform2.submit()"} {else} {include file="buttons/logout_menu.tpl" style="button" href="javascript:document.loginform2.submit()"} {/if} </TD> </TR> {if $usertype eq "C"} <TR> <TD colspan="2" align="right"> {if $js_enabled} {$lng.txt_javascript_disabled} {else} {$lng.txt_javascript_enabled} {/if} </TD> </TR> {/if} <INPUT type="hidden" name="mode" value="logout"> <INPUT type="hidden" name="redirect" value="{$redirect}"> </FORM> </TABLE> {/capture} { include file="menu_mod.tpl" menu_content=$smarty.capture.menu }

so long as the button code I gave is within the form tags it should work, so you may want to try something like:


Code:
{* $Id: authbox_mod.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *} {capture name=menu} <TABLE border="0" cellpadding="0" cellspacing="0" width="100%"> <FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform2"> <tr> <TD width="1%"></TD> <TD width="99%"> <font color="#333333" size="4">{$login}{$lng.txt_logged_in}</font> {if $js_enabled} {include file="buttons/button.tpl" style="button" button_title=$lng.lbl_logoff href="javascript:document.loginform2.submit()"} {else} {include file="buttons/logout_menu.tpl" style="button" href="javascript:document.loginform2.submit()"} {/if} </TD> </tr> {if $usertype eq "C"} {/if} <INPUT type="hidden" name="mode" value="logout"> <INPUT type="hidden" name="redirect" value="{$redirect}"> </FORM> </TABLE> {/capture} {include file="menu_mod.tpl" menu_title=$lng.lbl_authentication menu_content=$smarty.capture.menu}

which is the code you gave me and my button code inserted......that might work

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #7  
Old 06-20-2006, 02:58 PM
 
rcg rcg is offline
 

Member
  
Join Date: Mar 2005
Posts: 18
 

Default

other than authbox_mod are there any other files which need modification?

Thanks for thi shelp it's been driving me insane!
__________________
X-Cart GOLD 4.0.17
Affiliate
RMA
AOM
Configurator
---
PHP 4.4.2
MYSQL 4.1.21
Reply With Quote
  #8  
Old 06-20-2006, 11:13 PM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

No, all I did was make a copy of the authbox and then adjust the opening form tag (to read loginform2) and the button code.

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:54 AM.

   

 
X-Cart forums © 2001-2020