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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-19-2007, 07:17 AM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default javascript hide problem

i've made an ajax profileditor

http://www.ragtek.org/tutorials/editor.htm
the fields are coded like this:
HTML Code:
<div class="smallfont"><span id="usertitle">test</span></div>Einladungen: <span id="einladungen">200</span>
now when i want to edit the "Einladungen" field, its working fine
but for usertitle im getting this error:
Quote:
usertitle.style has no properties
[Break on this error] usertitle.style.display = '';
the strange thing is:

usertitle.style.display = 'none'; is working,
usertitle.innerHTML = xml_sender.fetch_data(fetch_tags(xml_sender.handle r.responseXML, 'linkhtml')[0]); is also working,
but usertitle.style.display = ''; isn't working

the fields are updated, just the showpart isn't working :/
Reply With Quote
  #2  
Old 11-19-2007, 07:29 PM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can try
Code:
usertitle.style.display = 'inline';
// or 
usertitle.style.display = 'block';
But this shouldn't be happening. There must be something else in your code causing this problem.
Reply With Quote
  #3  
Old 11-19-2007, 07:39 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi
thx for answer

i don't know
as i said its the same function as my edit
edit() is working
edittitle() not
http://www.ragtek.org/forum/clientscript/profilajax.js
Reply With Quote
  #4  
Old 11-19-2007, 07:44 PM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could there be a problem with using the same global variable inputobj in both functions? Try declaring them as local variable in the functions with var inputobj = 'xxxx';
Reply With Quote
  #5  
Old 11-19-2007, 07:57 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i changed it=> same error
i think i'm missing something
Reply With Quote
  #6  
Old 11-20-2007, 01:13 PM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add some debugging stuff:

Code:
function savetitle(){
	if (editstate==true){

		if (xml_sender.handler.readyState == 4 && xml_sender.handler.status == 200)
		{
			if (xml_sender.handler.responseXML)
			{
				alert(usertitle); // should say HTML object or somthing
				usertitle.innerHTML = xml_sender.fetch_data(fetch_tags(xml_sender.handler.responseXML, 'linkhtml')[0]);
				container1.removeChild(editobj);
				alert(usertitle.innerHTML);
				alert(usertitle.style);
				alert(usertitle.style.display);
				usertitle.style.display = 'block';
				editstate=false;
			}
		}
	}
}
Reply With Quote
  #7  
Old 11-20-2007, 03:10 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1. alert= my input
2,3 => undefined

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

problem solved
i used a wrong variable so usertitle was the object + the input
shame on me
Reply With Quote
  #8  
Old 11-20-2007, 04:51 PM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good.

A suggestion also for you. You can make your edit, presave & save functions more generic, or even encapsulate them in an object, so you can reuse the same code for each of your fields Einladung, title etc.
Reply With Quote
  #9  
Old 11-20-2007, 05:02 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi

thx 4 the tipp, (i wanted to make it with objects) but atm i don't realy understand the oop part :/
i can use it by copy & paste ( i'm doing it for my ajax prefix addon http://www.ragtek.org/tutorials/select.htm ) but one thing is just copy,paste and change the objects and the other thing is to realy understand it and to use it by own things
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 12:13 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.07479 seconds
  • Memory Usage 2,245KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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