LISE Instance Item dropdown with blank

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

LISE Instance Item dropdown with blank

Post by andrewvideouk »

Hi guys

I am I am trying to work out how to do a dropdown option and the get the title from a other LISE module. I have it working but the only problem how you add a blank option at the start.

Thank you
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: LISE Instance Item dropdown with blank

Post by DIGI3 »

Not getting the answer you need? CMSMS support options
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: LISE Instance Item dropdown with blank

Post by DIGI3 »

For a temporary workaround, create a dummy LISE entry called "none" (or similar) in your other module, then exclude it from frontend display in your template or module tag.
Not getting the answer you need? CMSMS support options
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: LISE Instance Item dropdown with blank

Post by andrewvideouk »

Hi

I did thought about adding a create a dummy LISE entry but the only problem is that a admin can detele the entry and not understanding why its there.

Could I use a UDT? I am not sure how I do that. I am guessing I would have to call the information from the database and some how pass it to LISE.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1609
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: LISE Instance Item dropdown with blank

Post by DIGI3 »

Probably better to edit the .tpl LISE is using for that and put it in module_custom. A UDT would work too, but yeah would take some figuring out.
Not getting the answer you need? CMSMS support options
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: LISE Instance Item dropdown with blank

Post by andrewvideouk »

I am looking at the file and nothing sticks out what i need to change. Can't see any dropdown stuff.


This might be it? If its this what do I need to do?

Code: Select all


    {if isset($itemObject|default:[])}
      {foreach from=$itemObject->fielddefs item='fielddef'}
        {$fielddef->RenderInput($actionid, $returnid)}
      {/foreach}
    {/if} 
 

Cheers

Code: Select all


{$backlink}
<h3>{$header}</h3>
{$startform}
<div class="pageoverflow">
    <p class="pageinput">
      <input name="{$actionid}submit" class="lise_submit" value="{lang('submit')}" type="submit" />
      <input name="{$actionid}cancel" class="lise_cancel" value="{lang('cancel')}" type="submit" />
      <input name="{$actionid}apply" class="lise_apply" value="{lang('apply')}" type="submit" />
      <input name="{$actionid}save_create" class="lise_save_create" value="{$mod->ModLang('save_create')}" type="submit" />
    </p>
</div>
<!-- start tab -->
<div id="page_tabs">
	<div id="edititem">
		{$title}
	</div>
    {if isset($itemObject|default:[])}
      {foreach from=$itemObject->fielddefs item='fielddef'}
        {if $fielddef->type === 'Tabs'}
          {$fielddef->displayTabHeader()}
        {/if}
      {/foreach}
    {/if}
</div>
<!-- end tab //-->
<!-- start content -->
<div id="page_content"> 
  <div id="edititem_result"></div>
  <div id="edititem_c">

    {if isset($input_active)}
      <div class="pageoverflow">
        <p class="pagetext">{$mod->ModLang('active')}:</p>
        <p class="pageinput">{$input_active}</p>
      </div>
    {/if}

    {if $mod->GetPreference('display_create_date', 0) == 1}
      <div class="pageoverflow">
        <p class='pagetext'>{$mod->ModLang('create_time', '')}: <em style='font-weight: normal;'>{$itemObject->create_time}</em></p>
      </div>
    {/if}

    <div class="pageoverflow">
      <p class="pagetext">{$mod->GetPreference('item_title', '')}*:</p>
      <p class="pageinput">{$input_title}</p>
    </div>
    {if $hide_alias}
      {$input_alias}
    {else}
      <div class="pageoverflow">
        <p class="pagetext">{$mod->ModLang('alias')}:</p>{$alias|default:''}
        <p class="pageinput">{$input_alias}</p>
      </div>
    {/if}
    {if $hide_slug}
      {$input_url}
    {else}
      <div class="pageoverflow">
        <p class="pagetext">{$mod->ModLang('url')}:</p>{$url|default:''}
        <p class="pageinput">{$input_url}</p>
      </div>
    {/if}

    {if !$hide_time_control}
      <div class="pageoverflow">
        <p class="pagetext">{$mod->ModLang('time_control')}:</p>
        <p class="pageinput">{$input_time_control}</p>
      </div>

      <div id="expiryinfo"{if $use_time_control != true} style="display:none;"{/if}>
        <div class="pageoverflow">
          <p class="pagetext">{$mod->ModLang('start_time')}:</p>
          <p class="pageinput">{$input_start_time}</p>
        </div>

        <div class="pageoverflow">
          <p class="pagetext">{$mod->ModLang('end_time')}:</p>
          <p class="pageinput">{$input_end_time}</p>
        </div>
      </div>
    {/if}

    {if isset($itemObject|default:[])}
      {foreach from=$itemObject->fielddefs item='fielddef'}
        {$fielddef->RenderInput($actionid, $returnid)}
      {/foreach}
    {/if} 
 
  </div>

</div>

  <div class="pageoverflow">
    <p class="pagetext">&nbsp;</p>
    <p class="pageinput">
      <input name="{$actionid}submit" class="lise_submit" value="{lang('submit')}" type="submit" />
      <input name="{$actionid}cancel" class="lise_cancel" value="{lang('cancel')}" type="submit" />
      <input name="{$actionid}apply" class="lise_apply" value="{lang('apply')}" type="submit" />
      <input name="{$actionid}save_create" class="lise_save_create" value="{$mod->ModLang('save_create')}" type="submit" />
    </p>
  </div>
{$endform}
<!-- end content //-->
<__script__ type="text/javascript">
var action_id = '{$actionid}';
var item_id = '{$itemObject->item_id|default:-1}';
var ajax_url1 = '{$ajax_get_url}';
var ajax_url2 = '{$ajax_get_alias}';
var manually_changed1 = item_id;
var manually_changed2 = item_id;
var finished_setup = 0;
var ajax_xhr1 = 0;
var ajax_xhr2 = 0;
var ajax_timeout1;
var ajax_timeout2;
ajax_url1 = ajax_url1.replace(/amp;/g,'') + '&suppressoutput=1';
ajax_url2 = ajax_url2.replace(/amp;/g,'') + '&suppressoutput=1';

function ajax_geturl() { 
  var form = $('#lise_edititem form');
  var vtitle = $('#{$actionid}title').val();
  ajax_xhr = $.post(ajax_url1, { title: vtitle, itemid: item_id }, function(retdata){
    $('#{$actionid}url').val(retdata);
    ajax_xhr1 = 0;
});
}

function ajax_get_alias() { 
  var form = $('#lise_edititem form');
  var vtitle = $('#{$actionid}title').val();
  ajax_xhr = $.post(ajax_url2, { title: vtitle }, function(retdata){
    $('#{$actionid}alias').val(retdata);
    ajax_xhr2 = 0;
});
}

function on_change() {
  if( manually_changed1 < 1 && finished_setup == 1) {
    // ajax function to get a unique url given a title.
    if( ajax_timeout1 != undefined ) clearTimeout(ajax_timeout1);
    if( ajax_xhr1 = 0 ) xhr.abort();
    ajax_timeout1 = setTimeout(ajax_geturl,500);
}
  if( manually_changed2 < 1 && finished_setup == 1) {
    // ajax function to get a unique alias given a title.
    if( ajax_timeout2 != undefined ) clearTimeout(ajax_timeout2);
    if( ajax_xhr2 = 0 ) xhr.abort();
    ajax_timeout1 = setTimeout(ajax_get_alias,500);
}
}

jQuery(document).ready(function() {
  
  $('{$actionid}url').keyup(function() {
    var val = $(this).val();
    manually_changed1 = 0
    if( val != '' ) manually_changed1 = 1;
});
  
  $('{$actionid}alias').keyup(function() {
    var val = $(this).val();
    manually_changed1 = 0
    if( val != '' ) manually_changed2 = 1;
});

  $('form').ajaxStart(function() {
    $('*').css('cursor','progress');
});

  $('form').ajaxStop(function() {
    $('*').css('cursor','auto');
});

  $('#{$actionid}title').keyup(function() {
    on_change();
});

  finished_setup = 1;
  
  
  jQuery('[name=m1_apply]').live('click', function() {
    if (typeof tinyMCE != 'undefined') {
      tinyMCE.triggerSave();
  }
  
  var data = jQuery('form').find('input:not([type=submit]), select, textarea').serializeArray();
  
  data.push({
      'name': 'm1_ajax',
      'value': 1
  });
  data.push({
      'name': 'm1_apply',
      'value': 1
  });
  data.push({
      'name': 'showtemplate',
      'value': 'false'
  });
  
  var url = jQuery('form').attr('action');
  
  jQuery.post(url, data, function(resultdata, text) {
      var resp = jQuery(resultdata).find('Response').text();
      var details = jQuery(resultdata).find('Details').text();
      var htmlShow = '';
      if (resp === 'Success' && details !== '') {
        htmlShow = '<div class="pagemcontainer"><p class="pagemessage">' + details + '<\/p><\/div>';
    }
    else {
        htmlShow = '<div class="pageerrorcontainer"><ul class="pageerror">';
        htmlShow += details;
        htmlShow += '<\/ul><\/div>';
    }
    jQuery('#edititem_result').html(htmlShow);
    window.setTimeout(function(){ 
     $('.pagemcontainer').hide(); 
 }, 9000)
}, 'xml');
  return false;
});
});
</__script>

Post Reply

Return to “Modules/Add-Ons”