Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 01-27-2010, 09:44 PM
SorentoUltimate's Avatar
SorentoUltimate SorentoUltimate is offline
 
Join Date: Jul 2009
Location: Moschato, Athens, Greece
Posts: 338
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How I take the Data into JavaScript and return after some jobs

I put a new button at Creating Social Group Form and on click i run a JavaScript.

How can i read Form Fields data at JavaSript?

the form not use vBForm and $editorid !!!

Here the vBulletin Template

Code:
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle] - $custompagetitle</title>
</head>
<body>
$header
$navbar

<if condition="!$icononly">
<form action="group.php?do=$action" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="$action" />
<input type="hidden" name="groupid" value="$group[groupid]" />
<input type="hidden" name="url" value="$url" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
    <td class="tcat">
        $phrase
        <if condition="$_REQUEST['do'] == 'edit'">
            <span class="normal"><a href="group.php?$session[sessionurl]groupid=$group[groupid]">$group[name]</a></span>
        </if>
    </td>
</tr>
<tr>
    <td class="panelsurround" align="center">
        <div class="panel">
            <table><tr><td align="$stylevar[left]">

                <div class="smallfont">
                    <label for="socialgroupcategoryid">$vbphrase[social_group_category]:</label><br />
                    <select name="socialgroupcategoryid" id="socialgroupcategoryid">
                        <option value="">$vbphrase[select_a_category]</option>
                        $categoryoptions
                    </select>
                </div>

                <if condition="$show['title']">
                    <div class="smallfont">
                    <label for="groupname">$vbphrase[group_name]:</label><br />
                        <input type="text" class="bginput" name="groupname" id="groupname" size="50" maxlength="$vboptions[sg_name_maxchars]" value="$group[rawname]" tabindex="1" />
                    </div>
                </if>

                <div class="smallfont" style="margin-top:$stylevar[formspacer]px">
                    <label for="groupdescription">$vbphrase[group_description]: <span class="shade">($vbphrase[bbcode_not_allowed])</span></label><br />
                    <textarea class="bginput" name="groupdescription" id="groupdescription" cols="50" rows="5" tabindex="1">$group[rawdescription]</textarea>
                </div>

                <div class="smallfont" style="margin-top:$stylevar[formspacer]px">
                    <label for="grouptype">$vbphrase[group_type]:</label><br />
                    <select name="grouptype" id="grouptype">
                        <option value="public"$typeselected[public]>$vbphrase[group_type_public]</option>
                        <option value="moderated"$typeselected[moderated]>$vbphrase[group_type_moderated]</option>
                        <option value="inviteonly"$typeselected[inviteonly]>$vbphrase[group_type_inviteonly]</option>
                    </select>
                </div>

                <if condition="$show['options']">
                    <fieldset class="fieldset" style="margin-top:$stylevar[formspacer]px">
                        <legend>$vbphrase[group_options]</legend>
                        <div class="smallfont">
                            <if condition="$show['enable_group_albums']">
                                <div>
                                    <label for="enable_group_albums"><input type="checkbox" name="options[enable_group_albums]" id="enable_group_albums" value="1" $checked[enable_group_albums]/> $vbphrase[enable_albums]</label>
                                </div>
                            </if>
                            <if condition="$show['enable_group_messages']">
                                <div>
                                    <label for="enable_group_messages"><input type="checkbox" name="options[enable_group_messages]" id="enable_group_messages" value="1" $checked[enable_group_messages]/> $vbphrase[enable_messages]</label>
                                </div>
                            </if>
                            <if condition="$show['mod_queue']">
                            <div>
                                <label for="group_owner_mod_queue"><input type="checkbox" name="options[owner_mod_queue]" id="group_owner_mod_queue" value="1" $checked[mod_queue]/> $vbphrase[messages_must_be_approved_by_owner]</label>
                                </div>
                            </if>
                            <if condition="$show['join_to_view']">
                            <div>
                                <label for="join_to_view"><input type="checkbox" name="options[join_to_view]" id="join_to_view" value="1" $checked[join_to_view]/> $vbphrase[users_must_join_to_view_content]</label>
                                </div>
                            </if>
                            <if condition="$show['only_owner_discussions']">
                                <div>
                                    <label for="only_owner_discussions"><input type="checkbox" name="options[only_owner_discussions]" id="only_owner_discussions" value="1" $checked[only_owner_discussions]/> $vbphrase[only_owner_can_create_new_discussions]</label>
                        </div>
                            <else />
                                <input type="hidden" name="options[only_owner_discussions]" id="only_owner_discussions" value="$checked[only_owner_discussions]" />
                            </if>
                        </div>
                    </fieldset>
                </if>
            </td></tr></table>
        </div>

        <div style="margin-top:$stylevar[cellpadding]px">
            <input type="submit" value="$vbphrase[save]" class="button" accesskey="s" tabindex="1" />
            <input type="reset" value="$vbphrase[reset]" class="button" />
        </div>
    </td>
</tr>
</table>

</form>
</if>

<if condition="$show[editicon]">
<if condition="!$icononly"><br /></if>


<form enctype="multipart/form-data" action="group.php?do=updateicon" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="updateicon" />
<input type="hidden" name="groupid" value="$group[groupid]" />
<input type="hidden" name="icononly" value="$icononly" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
    <td class="tcat" colspan="2"><if condition="$icononly">$vbphrase[create_group_icon]<else />$vbphrase[edit_group_icon]</if></td>
</tr>
<tr>
    <td class="panelsurround" align="center">
    <div class="panel">
        <div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]">

            <fieldset class="fieldset">
                <legend>$vbphrase[current_group_icon]</legend>
                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                <tr valign="top">
                    <if condition="!$groupiconurl">
                    <td class="alt1" style="border:1px inset; padding:$stylevar[cellpadding]px">
                    <span class="smallfont">$vbphrase[no_group_icon]</span>
                    </td>
                    <else />
                        <td class="smallfont">
                        <img src="$groupiconurl" alt="$vbphrase[current_group_icon]"  border="0" style="margin-$stylevar[right]:8px;border:1px solid gray" />
                        </td>
                    </if>
                    <td class="smallfont">
                        <div style="margin-bottom:$stylevar[formspacer]px">$vbphrase[group_icon_desc]</div>
                        <if condition="$show['deleteicon']"><div style="margin-bottom:$stylevar[formspacer]px"><label for="groupicon"><input type="checkbox" name="deletegroupicon" value="1" id="groupicon" />$vbphrase[delete_current_image]</label></div></if>
                    </td>
                </tr>
                </table>
            </fieldset>


            <fieldset class="fieldset">
                <legend>$vbphrase[custom_group_icon]</legend>

                <div style="padding:$stylevar[formspacer]px">
                <div class="fieldset">

                $vbphrase[may_upload_custom_image_controls]<br /><br />

                <if condition="$show['url_option']">
                $vbphrase[enter_url_to_image]
                <div style="padding:$stylevar[formspacer]px">
                    <input type="text" class="bginput" name="iconurl" value="http://www." size="45" dir="ltr" />
                </div>
                </if>

                <if condition="$show['url_option']">$vbphrase[option_2_upload_image_from_computer]<else />$vbphrase[upload_image_from_computer]</if>
                <div style="padding:$stylevar[formspacer]px">
                    <input type="file" class="bginput" name="upload" size="45" />
                    <input type="hidden" name="MAX_FILE_SIZE" value="$inimaxattach" />
                </div>

                $maxnote

                </div>
                </div>
            </fieldset>

        </div>
    </div>

    <div style="margin-top:$stylevar[cellpadding]px">
        <input type="submit" class="button" value="$vbphrase[save_changes]" accesskey="s" />
        <input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" />
        <input type="submit" class="button" value="$vbphrase[skip]" name="skip" accesskey="p" />
    </div>
    </td>
</tr>
</table>

</form>
</if>

$footer
</body>
</html>
___


i want to take the groupname and the groupdescription.
Reply With Quote
  #2  
Old 01-27-2010, 11:07 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure if I know what you're asking, but maybe this example will help? http://www.w3schools.com/js/tryit.as...s_formvalidate
Reply With Quote
  #3  
Old 01-28-2010, 11:56 PM
SorentoUltimate's Avatar
SorentoUltimate SorentoUltimate is offline
 
Join Date: Jul 2009
Location: Moschato, Athens, Greece
Posts: 338
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks kh99,

for the Social Group Form work perfect!!!

but i do the same for Albums Edit and not work....

here the Albums Edit template

Code:
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
$usercss
<title>$vboptions[bbtitle] - <if condition="$albuminfo['albumid']">$vbphrase[edit_album]<else />$vbphrase[add_album]</if></title>
</head>
<body>
$header
$navbar

<div id="usercss">

<if condition="$show['delete_option']">
<form action="album.php?do=killalbum&amp;albumid=$albuminfo[albumid]" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="killalbum" />
<input type="hidden" name="albumid" value="$albuminfo[albumid]" />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
    <td class="tcat">
        $vbphrase[delete_album]
    </td>
</tr>
<tr>
    <td class="panelsurround" align="center">
    <div class="panel">
        <div style="width:$stylevar[formwidth]" align="$stylevar[left]">
            <div class="smallfont">
                <span style="float: $stylevar[right]"><input type="submit" class="button" value="$vbphrase[delete_album]" accesskey="d" tabindex="1" /></span>
                <input type="checkbox" name="delete" id="cb_delete" value="1" /><label for="cb_delete">$vbphrase[to_delete_this_album]</label></div>
            </div>
        </div>
    </div>
    </td>
</tr>
</table>
</form>

<br />
</if>

$errortable

<form action="album.php?do=updatealbum&amp;u=$userinfo[userid]&amp;albumid=$formdata[albumid]" method="post">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
    <td class="tcat">
        <if condition="$albuminfo['title']">
            <span class="smallfont normal" style="float: $stylevar[right]"><b>$vbphrase[album]</b>: <a href="album.php?$session[sessionurl]albumid=$albuminfo[albumid]">$albuminfo[title_html]</a></span>
        </if>
        <if condition="$albuminfo['albumid']">$vbphrase[edit_album]<else />$vbphrase[add_album]</if>
    </td>
</tr>
<tr>
    <td class="panelsurround" align="center">
    <div class="panel">
        <div style="width:$stylevar[formwidth]">
            <table><tr><td align="$stylevar[left]">
            <if condition="$show['album_used_in_css']">
                <fieldset style="margin-bottom: $stylevar[cellpadding]px" class="fieldset">
                    <div class="smallfont" style="margin: $stylevar[cellpadding]px">
                        $vbphrase[album_pictures_used_profile_styling]
                    </div>
                </fieldset>
            </if>

            <div class="smallfont">
                $vbphrase[title]:
                <div><input type="text" class="bginput" name="title" value="$formdata[title]" size="50" tabindex="1" /></div>
            </div>

            <div style="margin-top: $stylevar[cellpadding]px" class="smallfont">
                $vbphrase[description]: <span class="shade">($vbphrase[bbcode_not_allowed])</span>
                <div><textarea name="description" rows="5" cols="50" tabindex="1">$formdata[description]</textarea></div>
            </div>

            <div style="margin-top: $stylevar[cellpadding]px" class="smallfont">
                $vbphrase[album_type]:
                <div><label for="rb_albumtype_public"><input type="radio" name="albumtype" value="public"  id="rb_albumtype_public" $formdata[albumtype_public] />$vbphrase[public]</label></div>
                <div><label for="rb_albumtype_private"><input type="radio" name="albumtype" value="private" id="rb_albumtype_private" $formdata[albumtype_private] />$vbphrase[private_only_visible_contacts_moderators]</label></div>
                <if condition="$show['albumtype_profile']"><div><label for="rb_albumtype_profile"><input type="radio" name="albumtype" value="profile" id="rb_albumtype_profile" $formdata[albumtype_profile] />$vbphrase[profile_pictures_modify_profile_style]</label></div></if>
            </div>
            </td></tr></table>
        </div>
    </div>

    <div style="margin-top:$stylevar[cellpadding]px">
        <input type="hidden" name="s" value="$session[sessionhash]" />
        <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
        <input type="hidden" name="do" value="updatealbum" />
        <input type="hidden" name="albumid" value="$formdata[albumid]" />
        <input type="submit" class="button" value="$vbphrase[submit]" accesskey="s" tabindex="1" />
    </div>
    </td>
</tr>
</table>
</form>

</div>

$footer
</body>
</html>
the fields i want to take from here are title, description

but javascript cannot read title and description....

any idea???
Reply With Quote
  #4  
Old 01-29-2010, 12:33 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think it may be because the tags for the title and description have no id attributes.

For example the delete checkbox has

Code:
<input type="checkbox" name="delete" id="cb_delete" value="1" />
but the title input field:

Code:
<input type="text" class="bginput" name="title" value="$formdata[title]" size="50" tabindex="1" />

has no id.
Reply With Quote
  #5  
Old 01-29-2010, 01:14 AM
SorentoUltimate's Avatar
SorentoUltimate SorentoUltimate is offline
 
Join Date: Jul 2009
Location: Moschato, Athens, Greece
Posts: 338
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks again,

if i add id's at templates it's ok or i will have other problems ???
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:02 AM.


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.05135 seconds
  • Memory Usage 2,229KB
  • 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
  • (4)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
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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
  • 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