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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-06-2015, 01:06 PM
senior01 senior01 is offline
 
Join Date: May 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Ajax: vbullein_profiefield.js

Code:
Hello,

this is exacly the code what i need for my new template. 
on my new template i need to place two buttons to work whit them. 
i hang on one row an dont understand, why getElementsByTagName don't to find the "form" TAG? 

Answer from C.responseXML.getElementsByTagName('team_template")[0].firstChild.nodeValue

response = <form>
<fieldset>
	<div>
            <input type="text" class="primary textbox" name="postid[43473]" id="cfield_43473" value="Das Forum..." tabindex="1" maxlength="100" />
        <p class="description">Das Forum</p>
            <input type="hidden" name="postid[43473_set]" value="1" />
	<div id="field_edit_error_container" class="hidden">
	    <img class="inlineimg" src="images/Seamus/statusicon/wol_error.png" alt="Fehler" />
	    <span id="field_edit_errors"></span>
	</div>
        <div>
	    <input type="submit" id="submitbutton" class="userprof_button" value="  Speichern  " />
	    <input type="reset" id="cancelbutton" class="userprof_button" value="Abbrechen" />
	    <img class="hidden" id="field_edit_progress" src="images/Seamus/misc/progress.gif" alt="" />
	</div>
	</div>
</fieldset>
</form>


cmd:
        this.element.innerHTML = C.responseXML.getElementsByTagName("template")[0].firstChild.nodeValue;
        this.form = this.element.getElementsByTagName("form")[0];

        for (var B = 0; B < this.form.elements.length; B++) {
            if (this.form.elements[B].tagName == "INPUT" || this.form.elements[B].tagName == "SELECT" || this.form.elements[B].tagName == "TEXTAREA") {
                this.form.elements[B].focus();
                break
            }
        }

console.log:
vbulletin_team_edit.js?v=422:100 form? = undefined

vbulletin_team_edit.js?v=422:105 Uncaught TypeError: Cannot read property 'elements' of undefined
vbulletin_team_edit.js?v=422:64


if i change the tag from "form" to other tag like "p" then, 
the log console says that they accept the other tag, but i need in this case the "form" tag. 
If i try it to get it with "getElementbyID" or "getElementsbyID" it shows me the answer that the Function ist not defined, 

console.log:
element = [object HTMLElement]

sorry for my bad english....


Best Regards,
Senior
Reply With Quote
  #2  
Old 01-06-2015, 02:13 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is this.element already inside a form? I think if you try to create a form inside another form you might end up with the problem you are having.
Reply With Quote
Благодарность от:
ozzy47
  #3  
Old 01-06-2015, 02:53 PM
senior01 senior01 is offline
 
Join Date: May 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you are right

many thanks for your help!


Best Regards,
Senior
Reply With Quote
2 благодарности(ей) от:
MarkFL, ozzy47
  #4  
Old 01-06-2015, 09:41 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@senior01, next time you post code, could you please wrap it in code tags, like this. Thanks.

Code:
Answer from C.responseXML.getElementsByTagName('team_template")[0].firstChild.nodeValue

response = <form>
<fieldset>
<div>
<input type="text" class="primary textbox" name="postid[43473]" id="cfield_43473" value="Das Forum..." tabindex="1" maxlength="100" />
<p class="description">Das Forum</p>
<input type="hidden" name="postid[43473_set]" value="1" />
<div id="field_edit_error_container" class="hidden">
<img class="inlineimg" src="images/Seamus/statusicon/wol_error.png" alt="Fehler" />
<span id="field_edit_errors"></span>
</div>
<div>
<input type="submit" id="submitbutton" class="userprof_button" value=" Speichern " />
<input type="reset" id="cancelbutton" class="userprof_button" value="Abbrechen" />
<img class="hidden" id="field_edit_progress" src="images/Seamus/misc/progress.gif" alt="" />
</div>
</div>
</fieldset>
</form>


cmd:
this.element.innerHTML = C.responseXML.getElementsByTagName("template")[0].firstChild.nodeValue;
this.form = this.element.getElementsByTagName("form")[0];

for (var B = 0; B < this.form.elements.length; B++) {
if (this.form.elements[b].tagName == "INPUT" || this.form.elements[b].tagName == "SELECT" || this.form.elements[b].tagName == "TEXTAREA") {
this.form.elements[b].focus();
break
}
}

console.log:
vbulletin_team_edit.js?v=422:100 form? = undefined

vbulletin_team_edit.js?v=422:105 Uncaught TypeError: Cannot read property 'elements' of undefined
vbulletin_team_edit.js?v=422:64
Reply With Quote
  #5  
Old 01-07-2015, 11:40 AM
senior01 senior01 is offline
 
Join Date: May 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry, i have forget to set the code inside tag.

thanks

Best Regards,
Senior
Reply With Quote
Благодарность от:
ozzy47
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 11:06 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04162 seconds
  • Memory Usage 2,212KB
  • Queries Executed 11 (?)
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)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (4)post_thanks_box_bit
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete