DB submission select and field loader.

sammie94 09 Jun, 2011
Hi everybody,

I'm using chronoforms for quite a while now and i really love it, but unfortunately i got stuck on this problem:
I created a form in whit several sorts of inputs. These are stored in a DB.
Now i want to be able to choose a submission and load some fields of that in another form, the fields are the e-mail and the name.
Then i want to send, with the form that has been partially populated, an e-mail to the guy that filled in the first form.
That last thing is alrady working only the submission selector and the field loader.
I have read the tutorials, but they dont explain how to do exactly what do.
I'm not a html genius, so please tell me where to put the code, if neccesary of course.

Greetings,
Sam
GreyHead 10 Jun, 2011
Hi Sam,

Which version of ChronoForms are you using?

I'm not clear what you have got working already?

How do you want to choose the submission? Is a drop down enough?

Bob
sammie94 10 Jun, 2011
Thanks for the quick respond!
I have one form working, thats the one which creates the submissions.
The form that chooses the submission and than auto-populates the fields isn't working yet.
Thats THE form i'm having trouble with.
A dropdown menu would be great but it has to show the latest submissions.
I hope this is enough information.

Sam

P.s. i use chronoform v4 RC 1.9 latest version.
GreyHead 10 Jun, 2011
Hi Sam,

Heres' an example of code to create a drop-down from a database query. In this case the data is taken from a 'get' parameter in the URL but it will also form with a 'post' parameter from a form:
<?php
$level =& JRequest::getString('sid', '', 'get');
if ( $level ) {
  $db =& JFactory::getDBO();
  $query = "
    SELECT `title` AS `id`, `title`
      FROM `jos_expertise`
      WHERE `up` = '$level'
";

  // print "$query";
  $db->setQuery($query);
  $data = $db->loadObjectList();

  if ( count($data) ) {
    $m = new stdClass();
    $m->id = 0;
    $m->title = '==?==';
    $data = array_merge(array($m), $data);
    $return = JHTML::_('select.genericlist', $data, 'title', 'class="inputbox required select" size="1" ', 'id', 'title', 0);
  } else {
    $return = "Sorry, we couldn't find that state";
  }
} else {
  $return = "Sorry, we couldn't find a state id";;
}
echo $return;
?>

Bob
sammie94 10 Jun, 2011
I have placed the code into a small form, and changed thye database to the name of the database i use.
I now get the error (Sorry, we couldn't find a state id).
Do i have to change more?
I placed the code in a custom code on the onload tab.
Like i already said i'm not a code genius.

Sam

It would really help me if you ould give me a short explenation of what to do.
For Example first change this.... than do this.... etc.
GreyHead 10 Jun, 2011
Hi Sam,

I can only give you more precise instructions if I know the form code and the database table structure that you are using. I have zero information about your site setup at present and my mind-reading isn't as good as it once was :-(

The other problem is that writing out precise instructions takes a lot more time than that doing the work itself :-(

Bob
This topic is locked and no more replies can be posted.