Administration:
"administrator/components/com_ckforms/views/ckfield/tmpl/ckfield_tpl.php" at line 466
- Code: Select all
<tr>
<td class="key"><label for="title"><?php echo JText::_( 'Event' ); ?>:</label></td>
<td ><input type="text" name="ckEvent" id="ckEvent" value="<?php if (Isset($this->ckfield->ckEvent)) echo $this->ckfield->ckEvent; ?>" /></td>
</tr>
<tr>
<td class="key"><label for="title"><?php echo JText::_( 'Function' ); ?>:</label></td>
<td><input type="text" name="ckFunction" id="ckFunction" value="<?php if (Isset($this->ckfield->ckFunction)) echo $this->ckfield->ckFunction; ?>" /></td>
</tr>
"administrator/components/com_ckforms/tables/ckfield.php" at line 112
- Code: Select all
var $ckEvent= null;
var $ckFunction= null;
Front-end
"component/ck_forms/views/ckforms/tmpl/default.php" at line 415
- Code: Select all
<select class="<?php echo $validationclass; ?> ckCSSinput <?php echo $field->fieldCSSclass; ?>" name="<?php echo $field->name; ?>[]" size="<?php echo $field->t_heightS; ?>" <?php if ($field->t_multipleS == '1') { ?> multiple<?php } ?> <?php if ($field->readonly == "1") {echo ' readonly="true"';} ?> <?php if(isset($field->ckEvent) && isset($field->ckFunction)){ echo $field->ckEvent.'="'.$field->ckFunction.'"'; } ?> >
To support this, I've also modified the database, by adding two columns in the 'jos_ckfields' table. I called them ckEvent(text) and ckFunction(text).
You can use this script to update your db:
- Code: Select all
alter table jos_ckfields add column ckEvent text, add column ckFunction text
The javascript functions called by the events should be in the file "component/ck_forms/views/ckforms/tmpl/default.php".
This implementation adds two text fields in Add field form (only when adding a select field), that allows the user to insert the name of the event (onchange, onclick, etc) and the js action involved (for example: javascript:form.submit();). Actually these fields are added as attributes of the select field, so they can be any other attribute that you want (the first field is the name and the second one is the value). Both fields are required in other to add the attribute (i.e. you wouldn't be able to add a name without a value and viceversa).
I hope that this contribution is helpful