Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to give a field a default value
JimR Offline
Junior Member
**
Posts: 15
Joined: Jun 2012
Post: #7
RE: How to give a field a default value
(02-28-2013 09:52 AM)ZiNgA BuRgA Wrote:  Well, your PHP code is in postbit so of course it's not going to have any effect editpost/newthread.

here is edit post ... I do not use newthread at all

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
include "llpg.php";
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="tabcontent.css" />
<title>{$mybb->settings['bbname']} - {$lang->edit_post}</title>
{$headerinclude}
<script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
<script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
<script type="text/javascript">jQuery.noConflict();</script>
</head>
<body> 
{$header}
{$post_errors}
{$attacherror}
<form action="editpost.php?pid={$pid}&amp;processed=1" method="post" enctype="multipart/form-data" name="input">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" colspan="4">
<tr class="tbar">
			<td class="tcat tab at" title="Overview" style="cursor: pointer; text-align: center; width: 10%;border-right:1px solid #Cedfeb;" abbr="tc1">
				<center><b>Overview</b></center>
			</td>
                            <td class="tab tcat" title="Garden Waste" style="cursor: pointer; text-align: center; width: 10%;border-right:1px solid #Cedfeb;" abbr="tc2">
				<center><b>Garden Waste</b></center></td>
                              <td class="tcat tab" title="Commercial" style="cursor: pointer; text-align: center; width: 10%;border-right:1px solid #Cedfeb;" abbr="tc3"><center><b>Commercial</b></center></td>
                               <td class="tcat tab" title="Notes"  style="cursor: pointer; text-align: center; width: 10%;border-right:1px solid #Cedfeb;" abbr="tc4"><center><b>Notes</b></center></td>
				
                              <td class="tcat" width="60%">
			</td></tr></table>

<div id="tc1" class="content tbar">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" colspan="4">
<tr>
<td class="tbar" valign="top"></td>
<td class="tbar" rowspan="10" valign="top" style="margin-top:10px;margin-left:5px;"><center><b>Property Status</b></center>
<div style="float:left;padding-left:110px;">Single Person <input type="checkbox" name=mybox value="1" disabled checked><br>Garden Waste <input type="checkbox" name=mybox1 value="0" disabled ></div
</td></tr>
<tr><td class="tbar" width="50%"><b><div style ="margin-left:10px">Customer&nbsp&nbsp&nbsp</b><br>{$GLOBALS['threadfields']['name']}</div></td></tr>
<tr><td class="tbar" width="50%"><b><div style="margin-left:10px">Address</div><div style="margin-left:10px"></b>$addressblock</div></td></tr>
<tr><td class="tbar" width="50%"><hr></td></tr>
</table>
</div>
<div id="tc2" class="content">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" colspan="3">
<tr class="tbar"><td class="tbar"></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr class="tbar"><td colspan="2" width="35%" valign="top">
<div class="tbar" style="border:1px solid black;border-radius:0.3em;float:left;width:100%;padding:5px;"><center><b>Customer Information</b></center>
<div style="padding:5px;float:left;"><b>Name :</b></div><div style="padding:5px;float:left;">{$tfinput['name']}</div><br style="clear:both">
<div style="padding:5px;float:left;"><b>Telephone No :</b></div><div style="padding:5px;float:left;">{$tfinput['tele']}</div>
<div style="padding:5px;float:left;"><b>Payment Method :</b> </div><div style="padding:5px;float:left;">{$tfinput['paym']}</div>
<div style="padding:5px;float:left"><b>Payment Reference :</b> </div><div style="padding:5px;float:left;">{$tfinput['cref']}</div>
<div style="padding:5px;float:left"><b>PIMM Reference Number :</b> </div><div style="padding:5px;float:left;">{$tfinput['pimm']}</div>
<div style="padding:5px;float:left"><b>Customer Account Number :</b> </div><div style="padding:5px;float:left;">{$tfinput['dnum']}</div>
</div></td>
<td colspan="4" valign="top"><div class="tbar" style="border:1px solid black;border-radius:0.3em;float:left;width:98%;padding:5px;"><b><center>Logistical Information</center></b>
<table><tr><td valign="top"><center><b>Collection Address</b></center>
<center><div style ="padding-bottom:5px">{$tfinput['add1']}</div>
<div style= "padding-bottom:5px">{$tfinput['add2']}</div>
<div style ="padding-bottom:5px">{$tfinput['add3']}</div>
<div style="padding-bottom:5px">{$tfinput['add4']}</div>
<div style="padding-bottom:5px">{$tfinput['pcode']}</center></td>
<td valign="top"><center><b>Collection Tags</b></center>
<div style="float:right;margin-right:20px;padding-bottom:1px;clear:both;"><b>In Scheme </b> {$tfinput['gcan']}</div>
<div style="float:right;margin-right:20px;padding-bottom:1px;clear:both;">{$tfinput['gass']}</div>
<div style="float:right;margin-right:20px;padding-bottom:1px;clear:both;">{$tfinput['da']}</div>

<div style="float:right;margin-right:20px;padding-bottom:1px;clear:both;">{$tfinput['gcoll']}</div>
<div style="float:right;margin-right:20px;padding-bottom:1px;clear:both;">{$tfinput['gnew']}</div>
<br>
</td></tr>
<tr><td colspan="2"><hr><br><div style="float:left;margin-right:20px;">{$tfinput['numb']}</div><div style="float:left;margin-right:20px;"><b>Collection Day</b></div><div  style="float:left;margin-right:20px;">{$tfinput['gcold']}</div><div style="float:left;margin-right:20px;"><b>Collection Order</b></div>{$tfinput['gcolord']}</td></tr>

</table>
</div></td></tr>
<tr class="tbar"><td class="tbar" colspan="2" width="35%"><div class="tbar" style="border:1px solid black;border-radius:0.3em;float:left;width:100%;padding:5px;margin-top:-40px;"><div style="padding:5px;"><center><a href="#" class="button"> Map </a> <a href="#" class="button">Streetview</a> <a href="#" class="button">Find Day</a>
<a href="#" class="button">Find Order</a> <a href="#" class="button">Print Letter</a>
</center></div></div></td><td class="tbar" colspan="4"></td></tr>
</table>
</div>
<div id="tc4" class="content">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" colspan="4">
<tr><td class="tbar"><textarea name="message" id="message" rows="20" cols="120" tabindex="28">{$message}</textarea>
{$codebuttons}</td></tr>
</table> 
</div>
<div class="tbar"><br>
<div align="center" class="tbar" ><input type="submit" class="button" name="submit" value="Update" tabindex="23" accesskey="s" /> </div>
<input type="hidden" name="action" value="do_editpost" />
<input type="hidden" name="posthash" value="{$posthash}" />
<input type="hidden" name="attachmentaid" value="" />
<input type="hidden" name="attachmentact" value="" />
</form>
<br>
</div>
{$footer}
</body>
</html>

as you will see I have included the same file (llpg.php) within editpost template.... so with my fresh install of mybb
I defined a threadfield like so :
Title - address1
key - add1
Input Type - textbox
Default Value - test value
all the other option are left at default
the editpost template is

Code:
<div style ="padding-bottom:5px">{$tfinput['add1']}</div>

(yes that is all that is in this template) and still do not get any text (I expected to see "test value") in the threadfield ... what have I done wrong ?

03-01-2013 01:31 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
How to give a field a default value - JimR - 02-26-2013, 05:11 AM
RE: How to give a field a default value - JimR - 03-01-2013 01:31 AM

 Standard Tools
Forum Jump: