Forums

forms received details

jsonvega 10 Feb, 2009
Hi,

I have managed to produce my forms, and make it to work.
I did received my test applicaations, but I noticed that the checkbox is not working with me.
I'd check YES on my forms, but when I received it, It got YesYes NoNo on results.
Any help is appreciated.
Thanks
GreyHead 10 Feb, 2009
Hi jsonvega,

I think this is a known bug with the current version. Please post the html & template code for this field (just the snippets is good, I don't need the whole lot).

Bob
jsonvega 11 Feb, 2009
Thanks,

Here:
HTML

<div class="form_item">
  <div class="form_element cf_checkbox">
    <label class="cf_label">Does your business support education & awareness of heritage issues & preservation? </label>
    <div class="float_left">
      <input value="Yes " class="radio validate-one-required" id="Yes_" name="Yes_" type="checkbox">
      <label for="Yes_" class="check_label">Yes </label>
      <br>
      <input value="No" class="radio" id="No" name="No" type="checkbox">
      <label for="No" class="check_label">No</label>
      <br>
    </div>
  </div>
  <div class="clear"> </div>
</div>

TEMPLATE
<div class="form_item">
  <div class="form_element cf_checkbox">
    <label class="cf_label">Does your business support education & awareness of heritage issues & preservation? </label>
    <div class="float_left">
      <span style="color: #ff6600;">
        <span>{Yes_}</span>
        <label class="check_label" for="Yes_">Yes </label>
        <br />
        <span>{No}</span>
        <label class="check_label" for="No">No</label>
      </span>
      <br />
      <br />
    </div>
  </div>
</div>

Thanks

[[>> added line-breaks for clarity : greyhead <<]]
GreyHead 11 Feb, 2009
Hi jsonvega,

Edit the Form HTML to give both radio buttons the same name - only one (or none) will ever be true so this is no problem.
<div class="form_item">
  <div class="form_element cf_checkbox">
    <label class="cf_label">Does your business support education & awareness of heritage issues & preservation? </label>
    <div class="float_left">
      <input value="Yes " class="radio" id="awareness_yes" name="awareness" type="checkbox">
      <label for="awareness_yes" class="check_label">Yes </label>
      <br />
      <input value="No" class="radio validate-one-required" id="awareness_yes" name="awareness" type="checkbox">
      <label for="awareness_no" class="check_label">No</label>
      <br />
    </div>
  </div>
  <div class="clear"> </div>
</div>
I've left the ids unique and moved the "validate-one-required" to the last input in the group.

The template can now be much simpler
<div class="form_item">
    <label class="cf_label">Does your business support education & awareness of heritage issues & preservation? </label> <span style="color: #ff6600;">{awareness}</span>
</div>

Bob
jsonvega 11 Feb, 2009
i see, so what happens is they don't have a unique id.
thank you very much sir!

I'll do it right away!

cheers
GreyHead 11 Feb, 2009
Hi jsonvega,

Well, actually they have unique 'id's but the same name - to be technically correct :-)

Bob
jsonvega 11 Feb, 2009
hi again sir,

one more!😀

my form also include uploads, but it's doesn't work I think, coz when I receive the results, there's no info about the uploaded file.
it's image upload.
is it also be included as attachment in the result email?

thanks

heres the form upload code
<div class="form_item">
<div class="form_element cf_fileupload"><label
 class="cf_label"><font face="Arial, Helvetica, sans-serif">Banner
Upload (You can send it later on if not yet available via e-mail at
director[at]heritagewatch[dot]org</font></label><font
 face="Arial, Helvetica, sans-serif"><input
 class="cf_inputbox" size="20" id="file_0"
 name="file_0" type="file"></font></div>
<div class="clear"><font
 face="Arial, Helvetica, sans-serif"> </font></div>
</div>
<div class="form_item">
<div class="form_element cf_text"><span class="cf_text"><font
 face="Arial, Helvetica, sans-serif">Banner must be in 468x60
pixels. Only image files (*.jpg, *.png, *.gif) are allowed.</font></span></div>
GreyHead 11 Feb, 2009
Hi jsonvega,

It works OK for me in Chrome (no uploads work in my FireFox at the moment . . .) do you see the file in the uploads folder?

Bob

PS There's a tutorial on File Uploads in the Downlaods area here.
jsonvega 20 Feb, 2009
hi sir,

thanks for the help.

about the uploader, it's working fine now. and it's working in firefox. i didn't check the upload folder coz when I test the form with the uploader, I received the results in my email with the uploaded image attached. is that how it use to work? or it should be in the upload folder?
anyway I love it of how it works for me.

thank you!
j
GreyHead 20 Feb, 2009
Hi jsonvega,

If it's working that's great. And yes it should work like that (and there's also a copy in the uplods folder if you ever need it).

Bob
iMagic 28 Feb, 2009
I've been fooling with this for hours and can't figure out why images are not getting to my inbox or the uploads folder. I've been searching the forum and tried the multipart form addition under the general tab, checked file uploads tab...basically everything seems to be as it should according to the tut and posts I've found, but no joy. Anybody have a clue? Is this a bug in RC2? Is it firefox-I've read it works and doesn't work with firefox?

Anybody?
GreyHead 28 Feb, 2009
Hi iMagic,

It works with FireFox, IE6 & IE7 and Chrome (and probably Opera too).

The most common reasons - in no particular order - are (a) Uploads aren't enabled; (b) the Onsubmit code you found; (c) faulty folder permissions; and (d) bad syntax in the file types box.

Bob
iMagic 28 Feb, 2009
Checked all and they are right. Except possibly the onsubmit code. I found a post by you that said to use enctype='multipart/form-data' and that is all that I have in there right now. Perms are 755 and uploads are enabled with jpg|png types.

I'm running the latest joomla 1.5 and latest RC2 on a linux host.

Any ideas? Is there anything else I can provide to help you help me?
Max_admin 01 Mar, 2009
Hi iMagic,

please post a screenshot for the uploads tab and the general tab of your form ? and the form code or the code piece of the file field if possible!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
iMagic 01 Mar, 2009
Sorry for the delay. My fiance just found out her credit card is being charged bogus charges from companies in the US and GB and I had to help her track them down for the report to the FTC and FBI. Anyway...

Here you go, and thanks for the help. GREAT component BTW.

Here's the snippet. I have actually tried the top 2 at once, if that makes any difference to you. I'm sure this is something stupid on my part--hopefully not too stupid😮
<div title="form_item28" class="form_item" style="border: 0px none ; background-color: rgb(255, 255, 255);">
    <div class="form_element cf_fileupload">
      <label class="cf_label" style="width: 65px;">Headshot:</label>
      <input size="20" id="file_22" name="img_head" class="cf_inputbox" type="file">
    </div>
	<div class="clear"></div>
  </div>
<div title="form_item29" class="form_item" style="border: 0px none ; background-color: rgb(255, 255, 255);">
    <div class="form_element cf_text"><span class="cf_text">3/4 body shot - head to knees, no more, no less. FULL PHOTO, DO NOT CROP!</span></div>
	<div class="clear"></div>
  </div>
<div title="form_item30" class="form_item" style="border: 0px none ; background-color: rgb(255, 255, 255);">
    <div class="form_element cf_fileupload">
      <label class="cf_label" style="width: 40px;">Front:</label>
      <input size="20" id="file_23" name="img_front" class="cf_inputbox" type="file">
    </div>
	<div class="clear"></div>
  </div>
<div title="form_item31" class="form_item" style="border: 0px none ; background-color: rgb(255, 255, 255);">
    <div class="form_element cf_text"><span class="cf_text">If you have, or can take these additional shots, you should upload them as well.</span></div>
	<div class="clear"></div>
  </div>
<div title="form_item32" class="form_item" style="border: 0px none ; background-color: rgb(255, 255, 255);">
    <div class="form_element cf_fileupload">
      <label class="cf_label" style="width: 35px;">Side:</label>
      <input size="20" id="file_24" name="img_side" class="cf_inputbox" type="file">
   </div>
	<div class="clear"></div>
  </div>
<div title="form_item33" class="form_item" style="border: 0px none ; background-color: rgb(255, 255, 255);">
    <div class="form_element cf_fileupload">
      <label class="cf_label" style="width: 40px;">Back:</label>
      <input size="20" id="file_25" name="img_back" class="cf_inputbox" type="file">
    </div>
	<div class="clear"></div>
  </div>
<div title="form_item34" class="form_item" style="border: 0px none ; background-color: rgb(255, 255, 255);">
    <div class="form_element cf_textarea">
      <label class="cf_label">Additional comments:</label>
      <textarea name="comments" cols="60" id="text_29" rows="3" class="cf_inputbox"></textarea>
      <a class="tooltiplink" onclick="return false;"><img class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png" height="16" width="16" border="0"></a>
					<div class="tooltipdiv" style="display: none;">Additional comments: :: If contacted via another site, list the URL to your profile here.</div>
    </div>
	<div class="clear"></div>
  </div>
GreyHead 01 Mar, 2009
Hi IMagic,

The problem seems to be that you've changed the input names in the form html but not in the FileUpload info e.g.
. . . id="file_22" name="img_head" . . .
You need to use img_head in the File Uploads tab to identify the field correctly to ChronoForms.

Bob
iMagic 01 Mar, 2009
Thanks for the reply. Would that be considered a bug, or am I not supposed to change the ID's, because the wizard actually put that in the files uploads tab, I just insured it was there.

Thanks for the help.
iMagic 01 Mar, 2009
Worked like a charm. I wondered about that, but figured the wizard put the right ones in there, since when you muse over the fields in the wizard the tool tip uses form_item## rather than the names I put in there to identify them myself. I guess I just assumed it was doing something similar there.

I've linked this form to a database table, and changed the field type for the images to longblob. Now that it's working I see a filename there. Is it storing the actual image in the database and just displaying the associated filename? Because I should change the field type back if it's only storing the file name.

Thanks again for the help.
GreyHead 01 Mar, 2009
Hi iMagic,

I think that the file name/ link is all that is normally stored in the database. There was a post some time ago about how to store the images if you need to.

Bob
iMagic 01 Mar, 2009
Thanks for the help Bob.

I must be thick, because I've been searching and can't find anything other than the posts I read before. Nothing about how to store images themselves in the database. Could you point me to that thread?
GreyHead 01 Mar, 2009
Hi iMagic,

I can't see it either - but I found the code you need in an article here

Bob
iMagic 01 Mar, 2009
First, thanks for the help.

Maybe I should explain exactly what I want this to do. Keep in mind that I'm a photographer, and although I know enough to be dangerous, I'm not a programmer.

I want to insert up to 4 (2 req'd, 2 opt'l) images into my table when my form is submitted. The reason I want to use the database rather than hd is that my site is hosted and has a finite amount of disk space allotted, but to my knowledge there is no such quota on my database server account, which I want to use as off site backup of these records which I also keep locally. Although the code you pointed me to looks simple enough, and I could most likely figure out how to apply it to multiple images, I do not know where I should ad this code so that it is integrated into chronoforms in a bug free manor.

I read one of your other posts in which you said that the op's code didn't look like chronoform code. When I look at the autogen'd code and the code you pointed me to, I see that you are using JFactory to access the database, yet this code seems to be using straight php. So do I just insert this code into the autogen'd tab above the geterror() functions? And if so, what changes need to be made to use the JFactory variables in place of the example variables in this code snippet?

If there is a plugin/extension/etc that will do this for me, please point it out to me so I can stop wasting your time. If there is a man page that will describe the syntax and global variables I need to use in the various code blocks, specifically, point that out to me and I'll try to figure it out myself instead of further annoying you with my ignorance of programming.

Thanks again.
iMagic 02 Mar, 2009
I've looked around the site again and still can't find anything to help me figure this out.
GreyHead 02 Mar, 2009
Hi iMagic,

I'll sort out come code for you when I have a few minutes.

This does seem an odd way of doing off-site storage. You could use something like Carbonite for $50 a year and automate the whole thing (I have currently more than 50Gb stored that way); or there are a bunch of clould-based backup sites using Amazon's S3 storage for a pretty low prices.

Just thoughts . . .

Bob
GreyHead 02 Mar, 2009
Hi iMagic,

This isn't perfect but it is saving the images in the database (i haven't tried getting them back out again!). In the OnSubmit After box try
<?php
$images = array('img_head', 'img_side', 'img_front', 'img_back');
foreach ( $images as $v ) {
  if ( !empty($attachments[$v]) ) {
   $image = chunk_split(base64_encode(file_get_contents($attachments[$v])));
JRequest::setVar($v, $image, 'post');
  }
}
?>

Bob
iMagic 02 Mar, 2009
Thanks very much for the reply.

In my research int this issue, I've discovered something about an order to autogen the onsubmit blocks. If I put this code in the onsubmit after, won't it try to populate a record that doesn't exist yet? According to the order tab, autogen is run last (3), and if I remember correctly--and I may not--the record is created when autogen is run, yes? Or does cf create the record automatically on any attempt to insert? I guess you didn't need me to ask all that, but I'm trying to get a handle on this so I don't have to bother you any more.

BTW: my fiance is creating forms for a site she just set up, until last night all went well. She created one form last night that made several checkbox groups the same name and put a couple of dozen "radio"s--like 4 lines of them one right after the other--in the name field of a radio group (in html code), which is obviously messing up her email template and such. Is this a known bug, or would you be interested in the backup and screencaps to figure out what might have caused it? Could be operator error🙂 but I can't see how.

Thanks again.
iMagic 02 Mar, 2009
I tried it and it worked. I guess I just don't get the order business.
GreyHead 02 Mar, 2009
Hi iMagic,

The code snippet that I posted doesn't actually save anything, it just puts the encoded images into the $_POST array so that the standard ChronoForms Autogenerated code will save them. To work correctly it needs to run before the Autogenerated code.

I've noticed the repeated radio radio radio . . . in a couple of forms posted here. Definitely a bug though probably fairly benign. I image that Max will fix it in a future release, meanwhile you can just delete the extra copies if they are a problem.

Bob
iMagic 02 Mar, 2009
Thanks again for the help.
This topic is locked and no more replies can be posted.