Hi Bob,
i have to migrate exixsting V3-Forms to the new Version and i´m not so good in php. i have tried many hours but it didn´t work my way.
I have the following V3-form:
and this "on Submit"-code:
what ist the right way, so a stupid user like me can understand it??
Can i make this with Wizard or only with Custom-Code? Where ist to put wich Code? Can you help me please?
thx
Ralph
i have to migrate exixsting V3-Forms to the new Version and i´m not so good in php. i have tried many hours but it didn´t work my way.
I have the following V3-form:
<div class="form_item">
<div class="form_element cf_datetimepicker">
<label class="cf_label" style="width: 140px;"><strong>Teamsitzung vom </strong></label>
<input class="cf_datetime" title="" size="20" id="date_0" name="date_0" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 120px;"><strong>Protokoll:</strong></label>
<input class="cf_inputbox" maxlength="50" size="30" title="" id="text_1" name="text_1" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 120px;"><strong>Moderation</strong></label>
<input class="cf_inputbox" maxlength="50" size="30" title="" id="text_2" name="text_2" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_checkbox">
<label class="cf_label" style="width: 120px;"><strong>Anwesende:</strong></label>
<div class="float_left">
<input value="Peter" title="" class="radio" id="check00" name="check0[]" type="checkbox" />
<label for="check00" class="check_label">Peter</label>
<input value="Ariane" title="" class="radio" id="check01" name="check0[]" type="checkbox" />
<label for="check01" class="check_label">Ariane</label>
<input value="Andreas" title="" class="radio" id="check02" name="check0[]" type="checkbox" />
<label for="check02" class="check_label">Andreas</label>
<input value="Petra" title="" class="radio" id="check03" name="check0[]" type="checkbox" />
<label for="check03" class="check_label">Petra</label>
<input value="Klaus" title="" class="radio" id="check04" name="check0[]" type="checkbox" />
<label for="check04" class="check_label">Klaus</label>
<input value="Praktikantin" title="" class="radio" id="check05" name="check0[]" type="checkbox" />
<label for="check05" class="check_label">Praktikantin</label>
<br />
<input value="Heike" title="" class="radio" id="check06" name="check0[]" type="checkbox" />
<label for="check06" class="check_label">Heike</label>
<input value="Steffi" title="" class="radio" id="check07" name="check0[]" type="checkbox" />
<label for="check07" class="check_label">Steffi</label>
<input value="Michael" title="" class="radio" id="check08" name="check0[]" type="checkbox" />
<label for="check08" class="check_label">Michael</label>
<input value="Gerlinde" title="" class="radio" id="check09" name="check0[]" type="checkbox" />
<label for="check09" class="check_label">Gerlinde</label>
</div>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 200px;"><strong>Zielvereinbarung Klienten / konzeptionelle Themen:</strong></label><textarea class="cf_inputbox" rows="2" cols="50" title="" id="text_3" name="text_3">1.
2.</textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 200px;"><strong>Klienten:</strong></label><textarea class="cf_inputbox" rows="5" cols="50" title="" id="text_4" name="text_4">1.
2.</textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 200px;"><strong>Themen</strong></label><textarea class="cf_inputbox" rows="10" id="text_5" title="" cols="50" name="text_5">1.
2.
3.
4.</textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 200px;"><strong>Protokoll nächste Woche</strong></label><textarea class="cf_inputbox" rows="2" id="text_6" title="" cols="50" name="text_6"></textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 200px;"><strong>Autofahren nächste Woche</strong></label><textarea class="cf_inputbox" rows="2" id="text_10" title="" cols="50" name="text_10"></textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 120px;"><strong>Kurzinfos</strong></label>
<textarea class="cf_inputbox" rows="8" id="text_11" title="" cols="100" name="text_11"></textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 350px;"><strong>Zielvereinbarung Klienten / konzeptionelle Themen:</strong></label><textarea class="cf_inputbox" rows="10" cols="100" title="" id="text_12" name="text_12">1.
2.</textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 120px;"><strong>Themen:</strong></label><textarea class="cf_inputbox" rows="10" cols="100" title="" id="text_13" name="text_13">1.
2.
3.
4.</textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 120px;"><strong>Klienten</strong></label>
<textarea class="cf_inputbox" rows="10" id="text_14" title="" cols="100" name="text_14">1.
2.</textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_fileupload">
<label class="cf_label" style="width: 120px;">Uploads</label>
<input class="cf_fileinput cf_inputbox" title="" size="20" id="file_0" name="file_0" type="file" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Speichern" name="button_3" type="submit" /><input type="reset" name="reset" value="Zurücksetzen"/>
</div>
<div class="cfclear"> </div>
</div>
and this "on Submit"-code:
<p>Das Teamsitzungs-Protokoll wurde erfolgreich gespeichert!</p>
<?php
// get the form uploads information
$MyUploads =& CFUploads::getInstance($MyForm->formrow->id);
// extract the file path
$file_path = $MyUploads->attachments[file_0];
// remove the 'root folder' from the beginning
$file_url = substr($file_path, strlen(JPATH_SITE)+1);
//correct any mis-directed separators
$file_url = str_replace(DS, '/', $file_url);
// add the domain name to the beginning
$file_url = JURI::base().$file_url;
// save the URL into the form results
JRequest::setVar('file_url', $file_url);
$_POST['title'] = 'Teamsitzung vom '.$_POST['date_0'];
$_POST['introtext'] = nl2br('<strong>Protokoll: </strong>'.$_POST['text_1'].'<br><br><strong>Moderation: </strong>'.$_POST['text_2'].'<br><br><strong>Anwesende: </strong>'.$_POST['check0'].'<br><br><strong>Zielvereinbarung Klienten / konzeptionelle Themen: </strong><br>'.$_POST['text_3'].'<br><br><strong>Klienten: </strong><br>'.$_POST['text_4'].'<br><br><strong>Themen: </strong><br>'.$_POST['text_9']);
$_POST['fulltext'] = nl2br('<br><br><strong>Protokoll nächste Woche: </strong><br>'.$_POST['text_6'].'<br><br><strong>Autofahren nächste Woche: </strong><br>'.$_POST['text_10'].'<br><br><strong>Kurzinfos: </strong><br>'.$_POST['text_11'].'<br><br><strong>Zielvereinbarung Klienten / konzeptionelle Themen: </strong><br>'.$_POST['text_12'].'<br><br><strong>Themen: </strong><br>'.$_POST['text_13'].'<br><br><strong>Klienten: </strong><br>'.$_POST['text_14'].'<br><br><strong>Datei: </strong><br>'.$_POST['file_0']);
$_POST['catid'] = '14';
$_POST['id'] = '';
$_POST['sectionid'] = '4';
$_POST['state'] = '1';
$_POST['created'] = date("Y-m-d H:i:s");
?>
what ist the right way, so a stupid user like me can understand it??
Can i make this with Wizard or only with Custom-Code? Where ist to put wich Code? Can you help me please?
thx
Ralph
i think you won´t help me because you suspect, i want to get the complete code....but this ist not my intention.
Can you help me for my understanding only this few questions:
Can i make this with Wizard or only with Custom-Code? Where ist to put the old "on Submit"-Code, if i have the Custom-Code way?
Is there somewhere a sample which is very close to my subject, where i can learn how to do?
thanks
Can you help me for my understanding only this few questions:
Can i make this with Wizard or only with Custom-Code? Where ist to put the old "on Submit"-Code, if i have the Custom-Code way?
Is there somewhere a sample which is very close to my subject, where i can learn how to do?
thanks
so, now i have solved the main Problem by testing fpr hours....
the following problem already exist:
How can i read the content from the checkbox array?
My code:
And in custom on submit the following snippet:
the artikle wich will be created shows:
what´s my mistake?
the following problem already exist:
How can i read the content from the checkbox array?
My code:
</div><div class="ccms_form_element cfdiv_checkboxgroup" id="check01_container_div" style=""><label>Anwesende</label><input type="hidden" name="check0" value="" alt="ghost" />
<div style="float:left; clear:none; width:440px;"><input type="checkbox" name="check0[]" id="check0_0" title="" value="Peter" class="" />
<label for="check0_0">Peter</label>
<input type="checkbox" name="check0[]" id="check0_1" title="" value="Ariane" class="" />
<label for="check0_1">Ariane</label>
<input type="checkbox" name="check0[]" id="check0_2" title="" value="Andreas" class="" />
<label for="check0_2">Andreas</label>
<input type="checkbox" name="check0[]" id="check0_3" title="" value="Petra" class="" />
<label for="check0_3">Petra</label>
<input type="checkbox" name="check0[]" id="check0_4" title="" value="Klaus" class="" />
<label for="check0_4">Klaus</label>
<input type="checkbox" name="check0[]" id="check0_5" title="" value="Heike" class="" />
<label for="check0_5">Heike</label>
<input type="checkbox" name="check0[]" id="check0_6" title="" value="Steffi" class="" />
<label for="check0_6">Steffi</label>
<input type="checkbox" name="check0[]" id="check0_7" title="" value="Michael" class="" />
<label for="check0_7">Michael</label>
<input type="checkbox" name="check0[]" id="check0_8" title="" value="Gerlinde" class="" />
<label for="check0_8">Gerlinde</label>
</div><div class="clear"></div><div id="error-message-check0"></div>
And in custom on submit the following snippet:
<p><strong>Anwesende: </strong><br>{$form->data['check0']}</p>
the artikle wich will be created shows:
Anwesende:
Array
what´s my mistake?
Hi Ralph,
Sorry for the delay, it's just been a busy week.
What does your Custom OnSubmit code do? I can’t see that from looking at it?
Bob
Sorry for the delay, it's just been a busy week.
What does your Custom OnSubmit code do? I can’t see that from looking at it?
Bob
hi bob,
this is my on submit custom code:
Thx Ralph
this is my on submit custom code:
<?php
$d =& $form->data;
$form->data['title'] = "Teamsitzung vom {$d['date_0']}";
$form->data['introtext'] = "<p><strong>Protokoll: </strong>{$d['text_1']}</p>
<p><strong>Moderation: </strong>{$d['text_2']}</p>
</br>
<p><strong>Anwesende: </strong><br>{$d['check0']}</p>
<p><strong>Zielvereinbarung Klienten / konzeptionelle Themen: </strong><br>{$d['text_3']}</p>
<p><strong>Klienten: </strong><br>{$d['text_4']}</p>
</br>
<p><strong>Themen: </strong><br>{$d['text_9']}</p>";
$form->data['fulltext'] = "<p><strong>Protokoll nächste Woche: </strong>{$d['text_6']}</p>
<p><strong>Autofahren nächste Woche: </strong>{$d['text_10']}</p>
</br>
<p><strong>Kurzinfos: </strong><br>{$d['text_11']}</p>
<p><strong>Zielvereinbarung Klienten / konzeptionelle Themen: </strong><br>{$d['text_12']}</p>
<p><strong>Themen: </strong><br>{$d['text_13']}</p>
</br>
<p><strong>Klienten: </strong><br>{$d['text_14']}</p>
</br>
<p>Datei: {$d['file_0']}</p>";
$form->data['sectionid'] = "18";
$form->data['catid'] = "14";
$form->data['state'] = "1";
$form->data['created'] = date("Y-m-d H:i:s");
?>
Thx Ralph
it should prepair the content from multiple fields for title, introtext and fulltext. after that i have an article submit action wich will save the data to content table.
Hi Ralph,
In ChronoForms v4 the output from a Custom Code action needs to be put into the $form->data array. ChronoForms only reads the $_POST array right at the beginning of the On Submit event so any changes after that will not be seen.
The Submit Article action will only pick up the four settings on the Fields tab: title, fulltext, introtext and author alias; some others will be created automatically: created_by, created, language, . . . and a couple are set for the form on the Settings tab: status and category.
If you need to change anything other than the four settings on the Fields tab then you probably can't use the Submit Article action. With a bit of work you can use a DB Save action instead.
Bob
In ChronoForms v4 the output from a Custom Code action needs to be put into the $form->data array. ChronoForms only reads the $_POST array right at the beginning of the On Submit event so any changes after that will not be seen.
The Submit Article action will only pick up the four settings on the Fields tab: title, fulltext, introtext and author alias; some others will be created automatically: created_by, created, language, . . . and a couple are set for the form on the Settings tab: status and category.
If you need to change anything other than the four settings on the Fields tab then you probably can't use the Submit Article action. With a bit of work you can use a DB Save action instead.
Bob
Hi bob,
i know this. The part of code ist a rest, where i´ve tried to do this with db-save action. But the submit article acction would be good for my purpose.
My Problem ist to put the checkbox content to the article. There ist only the word "array" in the article. How to do this?
i know this. The part of code ist a rest, where i´ve tried to do this with db-save action. But the submit article acction would be good for my purpose.
My Problem ist to put the checkbox content to the article. There ist only the word "array" in the article. How to do this?
This topic is locked and no more replies can be posted.