PDA

View Full Version : How to get the javascript edit for profile field on another page?


TNCclubman
03-23-2009, 09:05 PM
I want to set up a vB powered page and have the ability for the user to edit a field in their ABOUT ME section, from this new page. Ive got the following code all done (see below) and attached screenshot. The edit pencil links to the edit your details page which is a temp work around. What I want is to do the javascript instant inline editing like it does in their profile about me section. Can you have a look at my coding and let me know where (and what) to place in so that when I click on the pencil, you can instantly edit the profile field?

Thanks!!

<!-- ########## WHATS ON YOUR MIND ######### -->

<tr><td class="alt1" nowrap align="left">

<fieldset>
<a href="/profile.php?do=editprofile"><img src="/image.php?u=$bbuserinfo[userid]" alt="Some avatar" border="0" /></a>
<b>What's On Your Mind?:</b><br>
$bbuserinfo[field15]<a class="smallfont" href="profile.php?$session[sessionurl]do=editprofile"> <img class="inlineimg" border="0" src="/board/images/misc/userfield_edit.gif"/></a> </fieldset></td>
</tr>

<!-- ########## /WHATS ON YOUR MIND ######### -->

Lynne
03-23-2009, 09:11 PM
Did you read my post here (https://vborg.vbsupport.ru/showpost.php?p=1774674&postcount=11) about this?

TNCclubman
03-24-2009, 03:18 AM
yep, read it, tried the code you placed but nothing showed up.

Im not as advanced with this as I look, looking for someone with experience to help me get past the final loop and post the solution (code) to get it to work.

Anyone know the code to use?

TigerC10
03-24-2009, 04:01 AM
She's saying you should be doing this:


<!-- ########## WHATS ON YOUR MIND ######### -->

<tr><td class="alt1" nowrap align="left">

<fieldset>
<a href="/profile.php?do=editprofile"><img src="/image.php?u=$bbuserinfo[userid]" alt="Some avatar" border="0" /></a>
<dt class="shade" id="profilefield_title_15">What's On Your Mind?:</dt>
<dd id="profilefield_value_15">
$bbuserinfo[field15]
<script type="text/javascript">
<!--
vBulletin.register_control("vB_ProfilefieldEditor", "15");
//-->
</script>
</dd>
</fieldset>

</td></tr>

<!-- ########## /WHATS ON YOUR MIND ######### -->


Is that the code you tried?

TNCclubman
03-24-2009, 04:12 AM
actually that disabled the pencil I had there...and the javascript one isnt there either...

--------------- Added 1237872370 at 1237872370 ---------------

also this in your code
vBulletin.register_control("vB_ProfilefieldEditor", "1");

I changed to
vBulletin.register_control("vB_ProfilefieldEditor", "12");

and still no edit pencil...

TigerC10
03-24-2009, 04:35 AM
You should be sure to add in the .js includes... I thought you had done that already.


<script type="text/javascript" src="clientscript/vbulletin_profilefield_edit.js?v=$vboptions[simpleversion]"></script>

<!-- ########## WHATS ON YOUR MIND ######### -->

<tr><td class="alt1" nowrap align="left">

<fieldset>
<a href="/profile.php?do=editprofile"><img src="/image.php?u=$bbuserinfo[userid]" alt="Some avatar" border="0" /></a>
<dt class="shade" id="profilefield_title_15">What's On Your Mind?:</dt>
<dd id="profilefield_value_15">
$bbuserinfo[field15]
<script type="text/javascript">
<!--
vBulletin.register_control("vB_ProfilefieldEditor", "15");
//-->
</script>
</dd>
</fieldset>

</td></tr>

<!-- ########## /WHATS ON YOUR MIND ######### -->

TNCclubman
03-24-2009, 04:40 AM
wow, that worked you rock !!!!

TigerC10
03-24-2009, 04:43 AM
Use the variable $vboptions[simpleversion] instead of 381. You can put it anywhere above where you call it, the head is fine.

TNCclubman
03-24-2009, 04:52 AM
Thanks Tiger and Lynne!

Solution reached!

TNCclubman
03-24-2009, 12:54 PM
Actually, 1 more question...

The layout is taking up to much space by putting the text UNDER the avatar...

How can I put the text to the right of the avatar?

I've tried putting the avatar in the left cell of a table, and the text on the right, but the table structure breaks up the tables bad on the page Im using...

Is there another way to do it without tables?
(Ive attached a screenshot of the way it looks now, and how I want the layout to look...

Lynne
03-24-2009, 01:29 PM
Glad you got it to work.

You might want to post the template code that includes the avatar so we can see what html you are currently using. Also, post a few lines above and below the area of interest.

whitesoxfan5622
04-15-2009, 11:41 PM
I tried using this, but when i click the pencil, i get a popup saying undefined. Any help would be appreciated.

Thanks!

Here is the code im using:
<!-- ########## STEAM ID ######### -->

<script type="text/javascript" src="http://extremeg.org/forum/clientscript/vbulletin_profilefield_edit.js?v=$vboptions[simpleversion]"></script>

<tr><td class="alt1" nowrap align="left">

<fieldset>
<dt class="shade" id="profilefield_title_9">Steam ID:</dt>
<dd id="profilefield_value_9">
$bbuserinfo[field9]
<script type="text/javascript">
<!--
vBulletin.register_control("vB_ProfilefieldEditor", "9");
//-->
</script>
</dd>
</fieldset>

</td></tr>
<!-- ########## /STEAM ID ######### -->

http://www.extremeg.org/index.php?pageid=testinput thats the page its on if you want to see the error.

TigerC10
04-16-2009, 01:35 AM
I believe the issue is that you blindly copied the code without altering it to fit your page.

Here's a snippet from your page source:


<tbody id="collapseobj_module_12" style="">

<tr>
<td class="alt1">
<!-- ########## STEAM ID ######### -->

<script type="text/javascript" src="http://extremeg.org/forum/clientscript/vbulletin_profilefield_edit.js?v=382"></script>

<tr><td class="alt1" nowrap align="left">

<fieldset>
<dt class="shade" id="profilefield_title_9">Steam ID:</dt>
<dd id="profilefield_value_9">

<script type="text/javascript">
<!--
vBulletin.register_control("vB_ProfilefieldEditor", "9");
//-->
</script>
</dd>
</fieldset>

</td></tr>
<!-- ########## /STEAM ID ######### -->
</td>
</tr>

</tbody>


Do you notice how you've inserted code incorrectly? <tr><td> <tr><td></td></tr> </td></tr>

Try fixing that.

whitesoxfan5622
04-16-2009, 07:39 PM
Ok, thanks. I will try this.

--------------- Added 1239915162 at 1239915162 ---------------

I figured it out. I was making a page in VBa, but the index.php file was not under /forum. Once i moved it, it worked.

tommac3
04-26-2009, 11:41 PM
I would like to do something similar. I started a seperate thread.

https://vborg.vbsupport.ru/showthread.php?p=1799453

Basically I would like to add a "pencil" somewhere that will allow the member to edit a field in his profile. I would prefer a text box to a pencil ... but I will take a pencil if it is easier.