How to add a new Input Field Type?
nier3 Offline
Member
***
Posts: 125
Joined: Jul 2012
Post: #16
RE: How to add a new Input Field Type?
(09-17-2015 06:31 AM)RateU Wrote:  Very nice Smile

I just want to add an idea to work also (hopefully) when editing draft and post preview (or when inline post error triggered):

Code:
<if (THIS_SCRIPT == 'editpost.php' && !$mybb->input['my_post_key']) || (THIS_SCRIPT == 'newthread.php' && $mybb->input['action'] == 'editdraft') then><?=date('m/d/Y',{VALUE})?><else>{VALUE}</if>


Also (if not saving it as string), maybe it is better (in my opinion) to set the Underlying Data Type to Integer.

I use pikaday though.


Hi RateU, I tried the code but doesn't work Frown

For now I'm using this:

Code:
1
2
3
4
5
6
7
8
9
<if THIS_SCRIPT == 'editpost.php' && !$GLOBALS['threadfields']['datexp'] then>

<input type="text" class="textbox"{NAME_PROP}{MAXLE​​N_PROP}{WIDTH_PROP_SIZE}{TABINDE​X​_PROP}{REQUIRED_PROP} value="<?=date('Y/m/d', (int){VALUE})?>" id="datepicker" placeholder="editpost" />

<else>

<input type="text" class="textbox"{NAME_PROP}{MAXLE​​N_PROP}{WIDTH_PROP_SIZE}{TABINDE​X​_PROP}{REQUIRED_PROP} value="{VALUE}" id="datepicker" placeholder="newthread" />

</if>


With this the problem still is if user doesn't add a date in the field and I edit (and then save) the thread I have "1970/01/01" date instead of an empty field.

For the rest is ok: if I create a new thread I haven't problem; if I edit a thread with an existent date I have correct date (and not a string like before).

Date in preview post doesn't work Frown

09-20-2015 11:20 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
RE: How to add a new Input Field Type? - nier3 - 09-20-2015 11:20 AM

 Standard Tools
Forum Jump: