Is it possible to create a form which links directly into the jos_content table instead of creating my own?
If not
Is it possible to link 2 drop down boxes in the form wizard stage to the categories and sections i have in my jos_sections and jos_categories table?
If either of these are possible, what would be the best way of doing it? The problem im finding with this plugin is my coding is not too great. Thanks if u can help
Yes, - download and restore the submit_content.cfbak from from the Dowmloads area here.
You'll find several threads in the forums here on using it.
Bob
Not the best start for me at all. Ive seached high and low for submitcontent.cfbak. Especially in the download section above. I can see it exists in the forum discussions, but have no way of navigating to it? What is the URL to download your suggested .cfbak file?
regards
camastr
Ok, so the form is up, im publishing to the #__content and emails are flying through. nice!
I replaced the editor with a text field and used 2 drop downs for [Sections] and [Categories] in the form, positioned neatly.
Category dropdown does exactly what it says on the tin, it shows a list of categories. Im happy with that.
Sections however 😟 i can only display a fixed variable in the drop down . e.g. this code taken from your forum shows a cat with ID 1
<div>
<label class="cf_label">Location:</label>
<?php
echo JHTML::_('list.section', 'field_name');
?>
</br>
<?php
echo JHTML::_('list.category', 'field_name', '1');
?>
</div>
The problem i have is to do with that '1');. Id like to relate the categories in my second drop down to the section i have chosen in the first drop down. I read the 2 things you must do to on the 'submitcontent.cfbak' landing page however i didnt quite understand the 'onsubmit()' thing i should do to hold the values of Sections and categories or if this is what i need to do? I would appreciate a little pointer to get this working. its soooo close😀
I have tried replacing the '1' with 'section_id' This did not list anything other than 'select category'
The other problem i have is. If you select a selection from the drop down it does not publish this information. It will only publish the title, content, alias name etc. How do you make sure the selection im picking (likewise with the category, when its working) sticks to the _content table in my Database.
thanks in advance
Camastr
I will start with the 2nd problem, the dropdwon code should be:
echo JHTML::_('list.section', 'section_id');
and
echo JHTML::_('list.category', 'catid', '1');
the 2nd one will publish all categories is section 1, if you want the 2 dropdowns related then this some AJAX or JS, I suggest you upgrade to RC4.2 when its out then lets continue this post so that I can show you how to use the new features in RC4.2 to do this with ease!
Regards
Max
if you want the 2 dropdowns related then this some AJAX or JS, I suggest you upgrade to RC4.2 when its out then lets continue this post so that I can show you how to use the new features in RC4.2 to do this with ease!
Sure, i will keep this post alive throughout the development of CF. It is possible you can use the login form of http://www.abbreviationsmart.com as a working example/case study.
Just to confuse things, in my last post i said
Category dropdown does exactly what it says on the tin, it shows a list of categories. Im happy with that.
Sections however😟 i can only display a fixed variable in the drop down
I was however expecting a php solution. I think while you develop RC4.2, i will play about with creating a variable. Storing the section ID in the var and executing the Category ID WHERE CATID = SECID. I understand the theory of programming im just new to the php syntax. Im sure its not impossible. The race is on🙂 (ur task is much bigger tho)
Camastr
RC5 is out and you can add onchange event to the sections dropdown to AJAX get a URL like this:
index2.php?option=com_chronocontact&chronoformname=form_name&task=extra
and in the extra1 box you can use some PHP code to load a new categories dropdown for you!
let me know if you are interested and I will write a full example, alittle busy today!
Regards
Max
Sorry for the belated response, i have to admit, i did not expect a new release so prompt. Ive downloaded it and shall get things up and going hopefully Tuesday/Wednesday. Like usual my plate is heaped 😲 Im still needing to achieve the one to many relationship between sec and cat however i need to see CFv5 in action before i can query any further. I must admit, this is a great product. Ajax does appear to be the way forward these days.
Regards
Camastr
PS once this is up and running i wouldnt mind making a suggestion that would make this product stand out WAY above the rest (even though it already does). One thing at a time though as not to confuse the thread with a split conversation.
It took way longer than expected to get my content ready for my site. Anyhow, im jet set go now and would appreciate some help on linking that category to the section chosen in the dropdowns. Ive successfully installed ChronoForms_V3.1_RC5.0.
first step is to have Chronoforms validation or "load files" set to yes so that mootools is loaded!
we need to edit the section list select box to this code:
<?php echo JHTMLList::section( 'section_id', '', 'onChange="LoadCats()"') ; ?>
next step is to add this code to the JS box:
function LoadCats() {
var url = "index2.php?option=com_chronocontact&chronoformname=form_name_here&task=extra§ionid" + $('section_id').value;
new Ajax(url, {
method: 'get',
update: $('cats_div')
}).request();
}
now, in the Extra1 code box we need to place this code:
<?php
global $mainframe;
echo JHTMLList::category('catid', $_GET['section_id']) ;
$mainframe->close();
?>
This code is really tricky and needs testing and I didn't so that please be patient and let me know the results, we will walk through it till we get it working!😉
Regards
Max
Ive left the publish option up on http://www.abbreviationsmart.com . Ive enabled uploads, changed cat and sec drop down to
<?php echo JHTMLList::section( 'section_id', '', 'onChange="LoadCats()"') ; ?>
</br>
<?php echo JHTML::_('list.category', 'field_name', '1'); ?>
copied in the LoadCats JS in JS section and changed your
form_name_here
to submitcontent
I then pasted in the extra code1 and saved. As you will see. I get this
Fatal error: Class 'JHTMLList' not found in /home/content/b/a/m/bamastr/html/abb/components/com_chronocontact/chronocontact.html.php(153) : eval()'d code on line 25
and the first field. Any ideas?Camastr
echo JHTML::_('list.category', 'catid', '1');
Does this code shows a categories dropdown correctly ?
echo JHTML::_('list.category', 'catid', '1');
if so then please change this line:
<?php echo JHTMLList::section( 'section_id', '', 'onChange="LoadCats()"') ; ?>
to
<?php echo JHTML::_( 'list.section','section_id', '', 'onChange="LoadCats()"') ; ?>
then test and let me know!
Regards,
Max
The form is backup. But unfortunately you can see the two drop downs dont appear to be related. http://www.abbreviationsmart.com/index.php?option=com_chronocontact&Itemid=2
Just to confirm the code now is
<?php echo JHTML::_( 'list.section','section_id', '', 'onChange="LoadCats()"') ; ?>
</br>
<?php echo JHTML::_('list.category', 'catid', '1'); ?>
</div>
The categories loaded are infact all from Section 1. Or the value stated nect to catid
function LoadCats() {
var url = "index2.php?option=com_chronocontact&chronoformname=form_name_here&task=extra§ionid" + $('section_id').value;
new Ajax(url, {
method: 'get',
update: $('cats_div')
}).request();
}
it should be
function LoadCats() {
var url = "index2.php?option=com_chronocontact&chronoformname=form_name_here&task=extra§ionid=" + $('section_id').value;
new Ajax(url, {
method: 'get',
update: $('cats_div')
}).request();
}
notet he sign added after sectionid
#2-, in the Extra1 box we will change
<?php
global $mainframe;
echo JHTMLList::category('catid', $_GET['section_id']) ;
$mainframe->close();
?>
to
<?php echo JHTML::_('list.category', 'catid', $_GET['section_id']); ?>
then retest!
Regards
Max
Regards
Max
oh no! page 2! where did that come form? ive been sat on page 1 waiting for your reply for 2 days😶 ill get onto this on Saturday
Hi Camastr,
I didn't mention anything about "page2"🙂
Cheers
Max
right! ive added the missing '=' in the JS and replaced extracode1 to the one liner you suggested.
Im not sure what you meant by
and don't forget to add the categories dropdown in your form inside a div with id="cats_div"
so i tried nothing, which didnt work🙂
i tired
<div>
<label class="cf_label">Location:</label>
<?php echo JHTML::_( 'list.section','section_id', '', 'onChange="LoadCats()"') ; ?>
</br>
<?php echo JHTML::_('list.category', 'catid', 'id=cats_div'); ?>
</div>
and
<div>
<label class="cf_label">Location:</label>
<?php echo JHTML::_( 'list.section','section_id', '', 'onChange="LoadCats()"') ; ?>
</br>
<?php echo JHTML::_('list.category', 'catid', 'cats_div'); ?>
</div>
what is it you mean by adding the categories dropdown in your form inside a div with id="cats_div"?
thanks once again
Camastr
this code:
<?php echo JHTML::_('list.category', 'catid', 'id=cats_div'); ?>
should be like this:
<div id="cats_div">
<?php echo JHTML::_('list.category', 'catid', 'id=cats_div'); ?>
</div>
let me know!
Cheers
Max
<div>
<label class="cf_label">Location:</label>
<?php echo JHTML::_( 'list.section','section_id', '', 'onChange="LoadCats()"') ; ?>
</div>
<div id="cats_div">
<?php echo JHTML::_('list.category', 'catid', 'id=cats_div'); ?>
</div>
and
<div id="cats_div">
<label class="cf_label">Location:</label>
<?php echo JHTML::_( 'list.section','section_id', '', 'onChange="LoadCats()"') ; ?>
<br>
<?php echo JHTML::_('list.category', 'catid', 'id=cats_div'); ?>
</div>
It appears the actual template changes when you select a category and the category drop down disappears.
http://www.abbreviationsmart.com/index.php?option=com_chronocontact&Itemid=2
very odd
Sorry, some fixes needed!
the extra code should be:
<?php echo JHTML::_('list.category', 'catid', $_GET['sectionid']); ?>
and this code :
function LoadCats() {
var url = "index2.php?option=com_chronocontact&chronoformname=form_name_here&task=extra§ionid=" + $('section_id').value;
new Ajax(url, {
method: 'get',
update: $('cats_div')
}).request();
}
should now be:
function LoadCats() {
var url = "index2.php?option=com_chronocontact&chronoformname=form_name_here&task=extra&format=raw§ionid=" + $('section_id').value;
new Ajax(url, {
method: 'get',
update: $('cats_div')
}).request();
}
Please let me know!
Cheers
Max