This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Best way to have a printable form
Started 16 years ago by sonic | 12 posts |
-
Hi
I'm looking for the best way to have a printable form with Machform.
Key features:
-Forms have required fields.They must be check it befor printing.
-Forms should be printed space-saving, so that forms with a lot of fields can printing of one letterMany thanks
Sonic
Posted 16 years ago # -
Hmm.. I'm afraid the form itself wasn't really designed for printing purpose.
So there won't be any feature to check required fields before printing. You'll need to add your own javascript for this purpose.Regarding space saving, I suppose you can play around with the CSS of your form. Adjust the padding, margin, etc.
MachForm Founder
Posted 16 years ago # -
Hmm
I have a an other solution, but it's not 100%
1. I've selected "Form properties" "Show Review Page Before Submitting"
2. Now I can click on the button "continue"
3. Requirement fields are highlighted in rde and will be checked before continue.
4. A new windows opens. And here I have a problem. At the top I have this information"Review Your Entry
Please review your entry below. Click Submit button to finish."I need now the title of my form on this place and a print button.
Is this possible?
Posted 16 years ago # -
Hmm.. that's possiible.
You only need to modify includes/view-functions.php file for this purpose.
The HTML for the review page is placed around line 2356 - 2397. So basically you can simply put your print button there.
Regarding the form title, on line 2379, you should see this:
<h2>{$lang['review_title']}</h2>
change it to become:
<h2>{$form_title}</h2>
Then few lines above, around line 2305, you should see this code:
$query = "select form_has_css, form_redirect from ap_forms where form_id='$form_id'"; $result = do_query($query); $row = do_fetch_result($result);
change it to become:
$query = "select form_has_css, form_redirect, form_name from ap_forms where form_id='$form_id'"; $result = do_query($query); $row = do_fetch_result($result); $form_title = $row['form_name'];
That should display the title on your review page.
MachForm Founder
Posted 16 years ago # -
I'm on the best way to have my perfect form. Thanks Yuniar
-Where can I edit this text "Please review your entry below. Click Submit button to finish"
-Is it possible to enable also the "section break" so that I have the content into the confirm page?
Posted 16 years ago # -
1) Edit your includes/language.php file. Modify this line:
$lang['review_message'] = 'Please review your entry below. Click Submit button to finish.';
2) Hmm.. this might be not perfect, but try this, edit includes/entry-functions.php, search around line 206 for this code:
$query = "select element_id, element_type, element_constraint, element_title from ap_form_elements where form_id='$form_id' and element_type <> 'section' {$admin_clause} order by element_position asc";
change it to become:
$query = "select element_id, element_type, element_constraint, element_title from ap_form_elements where form_id='$form_id' {$admin_clause} order by element_position asc";
MachForm Founder
Posted 16 years ago # -
Hi Yuniar
Until now runs almost everything well, but I have 2 further questions.
I have 2 email field on my form (email to supervisor, email to user).
On the admin panel under Email, I can choose now:
"Your user" > "Sent to"
just one of these "email to supervisor" or "email to user", but I need both.The other question is: I have add "Section break" including html codes (images)
<img src="images/icons/date.gif" border="0" height="22" width="22" alt="date" />
Is it possible to send this images as well per email and also all other information. I Tried to add "Templates variables" but there are no variables for Section break. Unfortunately when I add {entry_data} for Complete Entry I receive just fields with content, but I wont all fields (including section breaks).
Many thanks
Sonic
Posted 16 years ago # -
Hi ...
I'am affraid it will take a lot modification in machform file (entry-functions.php, helper-functions.php, and post-functions.php) :).
1. entry-functions.php
make sure you have done what yuniar said, to edit around line 206
2. helper-functions.php- Edit line 275 ~ 285 to :
if($data['element_type'] == 'textarea'){ $template_values[$i] = nl2br($data['value']); }elseif ($data['element_type'] == 'file'){ if($target_is_admin === false){ $template_values[$i] = strip_tags($data['value']); }else{ $template_values[$i] = strip_tags($data['value'],'<a>'); } }elseif ($data['element_type'] == 'section') { $template_values[$i] = $data['label']; }else{ $template_values[$i] = $data['value']; }
- Insert this code to line 329 and 365, exactly below "foreach ($entry_details as $data){" code
if ($data['element_type'] == 'section') { $data['value'] = $data['label']; }
- Edit line 353 ~ 356
From :
$email_body .= "<tr {$row_style}>\n"; $email_body .= '<td width="40%" style="border-bottom:1px solid #DEDEDE;padding:5px 10px;"><strong>'.$data['label'].'</strong> </td>'."\n"; $email_body .= '<td width="60%" style="border-bottom:1px solid #DEDEDE;padding:5px 10px;">'.$data['value'].'</td>'."\n"; $email_body .= '</tr>'."\n";
to
if ($data['element_type'] <> 'section') { $email_body .= "<tr {$row_style}>\n"; $email_body .= '<td width="40%" style="border-bottom:1px solid #DEDEDE;padding:5px 10px;"><strong>'.$data['label'].'</strong> </td>'."\n"; $email_body .= '<td width="60%" style="border-bottom:1px solid #DEDEDE;padding:5px 10px;">'.$data['value'].'</td>'."\n"; $email_body .= '</tr>'."\n"; } else { $email_body .= "<tr {$row_style}>\n"; $email_body .= '<td width="40%" colspan="2" style="border-bottom:1px solid #DEDEDE;padding:5px 10px;"><strong>'.$data['label'].'</strong> </td>'."\n"; $email_body .= '</tr>'."\n"; }
3. Multiple email
and for multiple email sender, you can edit includes/post-functions.php. let say your form is having id = 12 and your email fields are having id 'element_2' and 'element_3'.Edit your includes/post-functions.php file between line 1117 ~ 1119, replace those lines with these:
//to email if(is_numeric($esr_email_address)){ if ($form_id == 12) { // <-- form id $esr_email_address1 = '{element_'.'2'.'}'; $esr_email_address2 = '{element_'.'3'.'}'; $esr_email_address = $esr_email_address1.','.$esr_email_address2 ; } else { $esr_email_address = '{element_'.$esr_email_address.'}'; } }
That should send email to 2 email form fields. :) i hope you not missing anything
MachForm Support
Posted 16 years ago # -
Hi
a lot of work :-)
_____________________3. Multiple email
I have edit post-funtions.php below (my form id is "1" and the 2 email fields have the id 29 & 33
if(is_numeric($esr_email_address)){ if ($form_id == 1) { // <-- form id $esr_email_address1 = '{element_'.'29'.'}'; $esr_email_address2 = '{element_'.'33'.'}'; $esr_email_address = $esr_email_address1.','.$esr_email_address2 ; } else { $esr_email_address = '{element_'.$esr_email_address.'}'; } }
but it doesn't work. I receive just 1 email ( depends on the admin panel setting "Your user" "sent to" > "email to supervisor" or "email to user".
When I choose "email to supervisor" then I receive just emails from this adress and vice versa.2. I don't see any picture only placeholder. Maybe is that a problem from Lotus Notes that pictures downloads are not allowed. I don't know. And I receive only fields with content. I would receive all fields if it's possible
Posted 16 years ago # -
Are you sure the element id is correct ? if you feel comfortable, can you give me the form url ?
For your 2nd question, if you want to embed the image to email you have to include full path of your image. Try to make this following changes :
before :
<img src="images/exec.png" />
after :
<img src="http://yourdomain.com/machform/images/exec.png" />
i assume that the image located on machform "images"
MachForm Support
Posted 16 years ago # -
You have right, the images need the full path, sorry my fault.
Unfortunately the user must have always connection to the internet to show the pictures (read the email). Is there another way to send / embedded pictures?Yes I'm shure to have used the right element email ID. Here the html source code:
</li> <li id="li_43" > <label class="description" for="element_43">Comments </label> <div> <textarea id="element_43" name="element_43" class="element textarea small" rows="8" cols="90"></textarea> </div> </li> <li id="li_15" > <label class="description" for="element_15"><STRONG><FONT color=#ff0000>Sign off direct from supervisor</FONT></STRONG> </label> <div> <input id="element_15" name="element_15" class="element text large" type="text" value="" /> </div> </li> <li id="li_29" > <label class="description" for="element_29">Email to supervisor </label> <div> <input id="element_29" name="element_29" class="element text medium" type="text" maxlength="255" value="" /> </div> </li> <li id="li_31" class="section_break"> <h3><img src="http://cuk-qs.cochlear.com:88/machform/images/icons/mail_generic2.gif" border="0" height="22" width="22" alt="person" /></h3> <p></p> </li> <li id="li_33" > <label class="description" for="element_33">Send a copy to you </label> <div> <input id="element_33" name="element_33" class="element text medium" type="text" maxlength="255" value="" /> </div> </li> <li id="li_buttons" class="buttons"> <input type="hidden" name="form_id" value="1" /> <input type="hidden" name="submit" value="1" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Continue" /> </li> </ul> </form> <div id="footer"> </div> </div> <img id="bottom" src="images/bottom.png" alt="" /> </body> </html>
Posted 16 years ago # -
hmmm .. it's odd, this work perfectly with me ? The element id seems right, have you set the form id condition with your form id (on first line) ?
example on url :
http://yourdomain.com/machform/view.php?id=5
change form_id on line 1117
if ($form_id == 5) { // <-- form id
and you have to set at least one email in mail menu (anything)
Emails-->Your users--> Email
and for email case.. sorry, I'm afraid that's not possible
MachForm Support
Posted 16 years ago #
Reply
You must log in to post.