How to hard code a value in a new event form

  • bneilson
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
12 years 21 hours ago #15386 by bneilson
Hello,

I am trying to hard coded a few values in my new event form and was hopeful that somebody might be able to assist.

In this case I want to hard code (or at least default) a value in the Cancel By Date for event registrations.

I have found the code that provides this line item in the form but I am not sure what needs to be modified.

<tr>
<td class="key">
<?php echo JText::_('EB_CANCEL_BEFORE_DATE'); ?>
</td>
<td>
<?php echo JHTML::_('calendar', $this->item->cancel_before_date != $this->nullDate ? JHTML::_('date', $this->item->cancel_before_date, $format, $param) : '', 'cancel_before_date', 'cancel_before_date'); ?>
</td>
</tr>


Any help or pointers would be greatly appreciated. I have a few of these that I am looking to do but this is one that is top on my list.

Thanks for a great product and this great forum and support.

-Brett

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
11 years 11 months ago #15399 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: How to hard code a value in a new event form
At the top of that file, you can use the code below :
Code:
if (!$this->item->id) { $this->item->cancel_before_date = 'the_value_you_want' ; }

You can do the same for all other fields (note, you will need to know basic php to do that) .

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc