Forums

Creating a new Submit an article form

pcheng 31 Jul, 2011
I know that my questions will be somewhere in this forum in some way or another but I thought I'd put my thoughts down while I am browsing the forums.

I want to create a form to replace the Submit An Article form which is available to authors in a Joomla site. The following are the changes that I would like to make:

1. Remove most of the options leaving only basic parts such as the Title, Author (should be automatically inserted) and Content of the Article.
2. In the content I want to make it into two text boxes. One would be the description of the article which will be available to everyone while the second one will be the Read More part which will only be available to some users. The problem I see here is to add the ReadMore code without the user clicking on the button. I want to make sure they never forget to set it.
3. In the Read More part I want to get several drop down options that will come from a table I created in Joomla. The selection on the first dropdown box will limit the options on the second one.
4. After the options are selected the author will be able to insert the combination in the read more section and then add another combination or stop.
5. Finally the author will be able to save the article.

Do you think that this is feasible or am I sinking into deep waters where I will eventually drown?

Thanks and I hope I find what I need here.
GreyHead 01 Aug, 2011
Hi Pcheng,

I'm sure that it can be done but take it one step at a time. get a basic from working, then add more features. You will need to know a bit about Joomla! and PHP.

You should start with the submit_article form for CFV3 from the Downloads area or the Submit Article action in CFv4.

Bob
pcheng 03 Aug, 2011
I have to admit that ChronoForms is a great tool. I just completed adding 4 forms in my joomla site. At first I tried to create the tables in Joomla and then get chronoforms to connect to them. But that didn't work correctly. Then I found the power of Create Table in ChronoForms. It created the tables for each of my forms and also added fields that I did not think about making it easier to record users and times.

Now I have my tables almost done and I need to start working on the dropdown options that will use the data from the tables. I found a couple of articles on that so its time to dig in and write more code.

I just wanted to provide an update of how I am doing.
GreyHead 03 Aug, 2011
Hi pcheng,

Well done.

Bob
pcheng 04 Aug, 2011
Well I managed to get the select code to get the options from the tables that were created. Now I have 2 small problems.

First, since I created the select boxes in a custom code they do not show up in the preview which is just a frustration but it leads to the second problem which is the fact that since they are not showing up in the preview then the $_POST does not get the values selected from the select boxes.

Here is the code that I added in the custom code just in case I am doing something wrong.
<?php
    $db =& JFactory::getDBO();
    $query = "SELECT DISTINCT `LeagueName` FROM `#__chronoforms_data_frmNewLeague` ORDER BY `LeagueName`;";
    $db->setQuery($query);
    $data = $db->loadObjectList();
?>
    <div class="ccms_form_element cfdiv_select" id="label_text_container_div">
      <label>League</label>
      <select class="" id="League" size="1" title="League" name="League" width="300" style="width: 300px">
<?php
    foreach($data as $d) {
      echo "<option value='".$d->LeagueName."'>".$d->LeagueName."</option>";
    }
?>
      </select></div>
<?php
    $query = "SELECT DISTINCT `TeamName` FROM `#__chronoforms_data_frmNewTeam` ORDER BY `TeamName`;";
    $db->setQuery($query);
    $data = $db->loadObjectList();
?>
    <div class="ccms_form_element cfdiv_select" id="label_text_container_div">
      <label>Team 1</label>
      <select class="" id="Team1" size="1" title="Team 1" name="Team1" width="300" style="width: 300px">
<?php
    foreach($data as $d) {
      echo "<option value='".$d->TeamName."'>".$d->TeamName."</option>";
    }
?>
      </select></div>
    <div class="ccms_form_element cfdiv_select" id="label_text_container_div">
      <label>Team 2</label>
      <select class="" id="Team2" size="1" title="Team 2" name="Team2" width="300" style="width: 300px">
<?php
    foreach($data as $d) {
      echo "<option value='".$d->TeamName."'>".$d->TeamName."</option>";
    }
?>
      </select>
pcheng 04 Aug, 2011
I found the problem. I was working the code in a custom code field using the wizard. I changed that and added it to the custom code in the normal Edit and that got all the changes.
pcheng 08 Aug, 2011
So all the basic stuff is ready and running. I got a few issues with some templates giving an error for JModel not found but I saw from the forums that its an easy fix by adding some information in the plugin that is responsible.

Now for the hard stuff. I need to build a form which will have a textbox and an ADD button. The ADD button will open up a new form which will allow the user to make a selection data from the database and when he presses submit it will add the text to the previous form. The user will then be able to press ADD as many times as he wants to add data and then submit the first form.

Is this possible from Chronoforms? Getting a form to open another and then get the data from the second form?
GreyHead 11 Aug, 2011
Hi pcheng,

It's possible to use JavaScript to open up hidden rows in a form. There are some examples in the forums here.

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