Notice

This old forum is now only available for consultation/read. User accounts on this old website are blocked.
Please create a new account on seblod.com and use the new forum http://www.seblod.com/community/forums.
Apologies for this perturbation and thank you for your understanding!
Welcome, Guest
Username Password: Remember me

FieldX custom form template
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: FieldX custom form template

FieldX custom form template 4 years, 9 months ago #1

  • slotpro
  • ( User )
  • OFFLINE
  • Moderator
  • Anti Spam !!
  • Posts: 143
hi

i'm create custom form but i'm have problem for show add and remove icon in fieldX

i'm use code below


<?php for ( $i = 0, $n = count( $jSeblod->my_fieldX); $i< $n; $i++ ) {?>
<label>My label</label>
<?php echo $jSeblod->my_fieldX[$i]->form; ?>

<?php }?>




thank
Last Edit: 4 years, 9 months ago by slotpro.

Re:FieldX custom form template 4 years, 9 months ago #2

  • slotpro
  • ( User )
  • OFFLINE
  • Moderator
  • Anti Spam !!
  • Posts: 143
Hi again

i can work add and remove icon use code below

<?php $n2=count( $jSeblod->rc_allitem ); {?>

<h2><?php echo $jSeblod->rc_allitem[0]->label; ?> </h2>
<span class="note">สามาเพิ่มช่องวัตถุดิบได้โดยการคลิกไอคอน <a href="javascript: addOption('<?php echo $jSeblod->rc_allitem[0]->name; ?>');"><img id="addoption-button"<?php if ( !( $n2 < $jSeblod->rc_allitem[0]->maximum ) ) { echo 'class="display-no"'; } ?> src="<?php echo $root; ?>/media/jseblod/_icons/add-default.png" border="0" alt="add" /></a></span>

<?php } ?>
<div id="<?php echo 'add-elem-parent-'.$jSeblod->rc_allitem[0]->name; ?>">
<?php for ( $i = 0; $i < $n2; $i++ ) { if ( $jSeblod->rc_allitem[$i] ) { ?>

<div id="<?php echo 'add-elem-child-'.$i.'-'.$jSeblod->rc_allitem[$i]->name; ?>">
<div id="<?php echo $jSeblod->rc_allitem[$i]->container; ?>">

<label>เครื่องปรุง : <?php echo $i+1 ?></label>
<?php echo $jSeblod->rc_allitem[$i]->form; ?>
<?php echo '&nbsp;<a title="'.($i+1).'" href="javascript: removeOption(\''.$jSeblod->rc_allitem[$i]->name.'\', '.$i.');"><img src="'.$root.'/media/jseblod/_icons/del-default.gif" alt="" /></a>' ?>
>
</div>
</div>
<?php } else { echo $jSeblod->rc_allitem[$i]->form; }?>
<?php }?>
</div>


but i want count lable you have any idea



thanks for answer
Last Edit: 4 years, 9 months ago by slotpro.

Re:FieldX custom form template 4 years, 9 months ago #3

  • slotpro
  • ( User )
  • OFFLINE
  • Moderator
  • Anti Spam !!
  • Posts: 143
hi

have new problem after click submit article , article show intro text can't view full text

i'm setting optional field but form required all field

image below show after submit show only introtext


thanks
Last Edit: 4 years, 9 months ago by slotpro.

Re:FieldX custom form template 4 years, 9 months ago #4

  • slotpro
  • ( User )
  • OFFLINE
  • Moderator
  • Anti Spam !!
  • Posts: 143
hi,

you have any idea after submit show only intro , i'm use custom template and custom form

Re:FieldX custom form template 4 years, 5 months ago #5

Hello
I'm just about to use fieldx in my custom form template.

Would anybody provide here a code for latest version with all the Javascript features (Delete, Repeat, Drag&Drop)..

Thanks

Michal

Re:FieldX custom form template 4 years, 5 months ago #6

Hello
I here it is if someone needs it.

Template:


<script type="text/javascript">
window.addEvent('domready', function(){
new Sortables($('<?php echo $jSeblod->your_field_x[0]->name; ?>'), {
'handles': $('<?php echo $jSeblod->your_field_x[0]->name; ?>').getElements('img.button-drag'),
});
});
</script>

<ul id="<?php echo $jSeblod->your_field_x[0]->name; ?>" class="collection-elem-repeatable">
<?php
$n8 = count ( $jSeblod->your_field_x );
for ( $i8 = 0; $i8 < $n8; $i8++ ) {?>

<li class="collection-elem-repeatable">
<div class="collection-elem-wrap">
<div class="collection-elem-button" style="width:125px;">
<img class="button-del" onclick="CCK_ELEM_Remove(this);" src="<?php echo $root; ?>/media/jseblod/_icons/del-default.gif" alt="Del" />
<?php if ( @$jSeblod->your_field_x[0]->repeatable ) { ?>
<img class="button-add" onclick="CCK_ELEM_Copy(this, <?php echo $jSeblod->your_field_x[0]->maximum; ?>);" src="<?php echo $root; ?>/media/jseblod/_icons/add-default.gif" alt="Add" />
<?php } ?>
<?php if ( @$jSeblod->your_field_x[0]->draggable ) { ?>
<img class="button-drag" src="<?php echo $root; ?>/media/jseblod/_icons/drag-default.gif" alt="Drag" />
<?php } ?>
</div>

<div class="collection-elem-form">
<?php echo $jSeblod->your_field_x[$i8]->form; ?>
</div>


</div>

</li>

<?php } ?>
</ul>



There must be also added css and javascript which can be found in params.php of default content form.

Javascript:


<script type="text/javascript">
function CCK_ELEM_Copy(el, maximum) {
var elem = $(el).getParent().getParent().getParent();
var list = elem.getParent();
var length = ( list.getChildren().length );

if ( length < maximum ) {
var newElem = elem.clone();

var listname = list.getProperty( 'id' );
var num = eval("elemmax_"+listname);
eval("elemmax_"+listname+"++");

newElem.setHTML( newElem.innerHTML.replace(/-\d-wysiwyg/g,"-"+num+"-wysiwyg") );

newElem.injectAfter(elem);

new Sortables($(listname), {
'handles': $(listname).getElements('img.button-drag'),
});
}
}
function CCK_ELEM_Remove(el) {
var elem = $(el).getParent().getParent().getParent();
elem.remove();
}
</script>


CSS:


/* GROUPS */
ul.collection-group-repeatable {
margin: 0;
padding: 0;
}
ul.collection-group-repeatable {
list-style: none;
margin: 0;
}
div.collection-group-wrap {
overflow: hidden;
}
div.collection-group-form {
margin-top: 5px;
margin-right: 10px;
margin-bottom: 5px;
margin-left: 0px;
float: left;
}
div.collection-group-button {
float: left;
padding-top: 3px;
}

/* ELEMENTS */
ul.collection-elem-repeatable {
margin: 0;
padding: 0;
}
li.collection-elem-repeatable {
list-style: none;
margin: 0;
}
div.collection-elem-wrap {
overflow: hidden;
}
div.collection-elem-form {
margin-top: 5px;
margin-right: 10px;
margin-bottom: 5px;
margin-left: 0px;
float: left;
}
div.collection-elem-button {
float: left;
padding-top: 3px;
}

/* BUTTONS */
img.button-del {
cursor: pointer;
}
img.button-add {
cursor: pointer;
}
img.button-drag {
cursor: move;
}



It works for me....

Michal
Last Edit: 4 years, 5 months ago by michalmarianek.
The following user(s) said Thank You: coscho

Re:FieldX custom form template 4 years, 4 months ago #7

  • iLLeT
  • ( User )
  • OFFLINE
  • Senior Boarder
  • Posts: 52
Thanks, worth a bookmark. Images did not show for me in localhost I had to delete the forward slash before media in the path.

Re:FieldX custom form template 4 years, 4 months ago #8

  • serval
  • ( User )
  • OFFLINE
  • Platinum Boarder
  • Posts: 500
Hello everybody.

Is it working with group content type ?

Re:FieldX custom form template 4 years, 1 month ago #9

serval wrote:
Hello everybody.

Is it working with group content type ?


Not working

Re:FieldX custom form template 4 years ago #10

  • coscho
  • ( User )
  • OFFLINE
  • Expert Boarder
  • Posts: 113
Hello

It works with fieldx. The greatest CCK Ever !!!

Thank you.
Last Edit: 4 years ago by coscho.

Re:FieldX custom form template 4 years ago #11

  • coscho
  • ( User )
  • OFFLINE
  • Expert Boarder
  • Posts: 113
Hello

It works with fieldx. The greatest CCK Ever !!!

Thank you.

Re:FieldX custom form template 2 years, 12 months ago #12

  • joechan
  • ( User )
  • OFFLINE
  • Senior Boarder
  • Posts: 55
Hi expert,

When using groupx and selecting "List" in style form, the deletable, draggable, and repeatable is not found in the form; however, when selecting "Horizontal" or "Vertical", it works fine.

Could somebody teach how to solve it.

Thanks a lot.
  • Page:
  • 1
Time to create page: 0.22 seconds