Forums

submitcontent questions

fredfitaire 01 Feb, 2011
Hi all,

I'm trying to set the submitcontent form in order to create an article from the form content.
I followed these topic http://www.chronoengine.com/forums.html?cont=posts&f=2&t=18710&p=55042&hilit=create+article#p55042 and succeeded in creating an article in the right section/category.

I would now like to give some different settings:

- I noticed that my article always starts by a "read more" line. How can I remove it ?
- the form shows an editor window (JCE on my site). How can I replace the editor by a simple text area ? I just want to have plain text within the article, as it is used for a newsfeed (through a Ultimate Content Display module)
- on the FormCode tab / On Submit code - after sending email, I replaced
$_POST['state'] = '0';
by a 1. Therefore, my article is published without the need of an administrator validation. So, how can I change the confirmation message "Thank you for submitting your story, we will review it shortly and if approved it will be published!". I just need to remove the last part of the message.

Thanks for your help😉
fredfitaire 01 Feb, 2011
I've found the answer to my third question: I just modified the "On Submit code - after sending email:" code.

For the second one, I've found a beginning of answer there http://www.chronoengine.com/forums.html?cont=posts&f=2&t=16459&p=43788&hilit=submitcontent#p43788
Unfortunately, I don't understand which part of my code is to be modified ...
On the html code, I have:
<?php
$editor		=& JFactory::getEditor();
echo $editor->display( 'fulltext',  '' , '80%', '350', '55', '20', false ) ;

?>

Where do I change the code to:
<textarea name="fulltext"></textarea>
??

The first question remains alive ! please help😉
fredfitaire 02 Feb, 2011
My article always starts by a "read more" line.
<hr id="system-readmore" />


How can I remove it ?
GreyHead 02 Feb, 2011
Hi fredfitaire ,

Perhaps by saving the content to introtext instead of fulltext?

The message you want to edit is in the OnSubmit After Email box I think.

Bob
fredfitaire 02 Feb, 2011
Thanks Bob, in the meantime I found myself the solution on this topic http://www.chronoengine.com/forums.html?cont=posts&f=2&t=12874&p=25330&hilit=submitcontent#p25330

Hard to scroll on the 20 results pages when you search for "onsubmitcontent" !
I suggest a page summing up all the tips.


I still have an issue with the "start publishing date" which is always set at "1999-11-30 01:00:00".
The "creation date" is OK.
I remember having found a topic about this issue, I will try to find it again ...


2 more questions (sorry ... !):

- any way to translate "This field is required" sentence ? (even by hacking a CF file)

- any possibility to add 2 fields in my form, a "start publishing date" and a "end publishing date", dates that can be chosen by my user ?

Thanks
GreyHead 02 Feb, 2011
Hi fredfitaire,

Did you try the 'ChronoSearch' (from the Tutorials menu above)? Searching there on 'submitcontent read more' cuts the results down to 4 pages.

You can set the start date by adding the value you want in the OnSubmit code box where the other values are set.

Adding a title attribute to an input will change the validation error message.

Yes, you an can add any other inputs to the form that you want provided that the saved data has the corrent column names.

Bob
fredfitaire 02 Feb, 2011
Bob,

You can set the start date by adding the value you want in the OnSubmit code box where the other values are set.


Could you please give me the right syntax to be used ?
I tried this on "On Submit code - after sending email" :
$_POST['published'] = date("Y-m-d H:i:s");

But it didn't work ...
I replaced "published" by several other words like "start", "started" ... without more success.
GreyHead 02 Feb, 2011
Hi fredfitaire,

If you check the jos_content table the column names are 'publish_up' and 'publish_down'.

Bob
fredfitaire 02 Feb, 2011
Ok, so I added on "On Submit code - after sending email" :

$_POST['publish_up'] = date("Y-m-d H:i:s");
$_POST['publish_down'] = date("Y-m-d H:i:s");


My "start publishing" and "finish publishing" dates are correctly field with the current date/time.


Now, I added two timepickers on my form, which ids are "date_1" and "date_2".

How can I modify the $_POST codes in order to retrieve the dates chosen by the form user ?

I tried codes like :

$_POST['publish_up'] = date('date_1');
$_POST['publish_down'] = date('date_2');


but it's not ok.

Many thanks for your help. I promise: one day I will learn php !😛
GreyHead 02 Feb, 2011
Hi fredfitaire ,

On the form General tab set the "Date Format" to Y-m-d.

Bob
fredfitaire 02 Feb, 2011
I modified the date format to Y-m-d but my following code does not retrieve the values of my timepickers ...

$_POST['publish_up'] = date('date_1');
$_POST['publish_down'] = date('date_2');
GreyHead 02 Feb, 2011
Hi fredfitaire,

Sorry, trying to do too many things at once.

just change the names of those inputs to 'publish_up' and 'publish_down' and alter the date fields names box to mtch - then you can remove this code.


Bob
fredfitaire 02 Feb, 2011
Dates are now retrieved, thanks !

I put a field in my form to get the name of the user (code found on another topic) :

<input value="<?php
$user =& JFactory::getUser();

  if ($user->guest) {
    echo "";
  } else {
     echo $user->name;
    }
?>" class="cf_inputbox required validate-alpha" maxlength="15" size="30" id="text_7" name="created_by_alias" type="text" readonly="readonly">
<div></div>


I voluntarily used echo $user->name; instead of username, but the names with letters like é, è, ... are not authorized. I get a "Please use letters only (a-z) in this field." message.
Anything I can do ? The stressed letters are often used in french ...
fredfitaire 02 Feb, 2011
I found myself a solution but it's a hack ...

On /www/components/com_chronocontact/chrono_verification.php file, line 21
I replaced what is within the line starting by $alphanum2 by:

$alphanum2  = "ABCDEFGHIJKLMNPQRSTUVWXYZ23456789abcdefghijkmnpqrstuvwxyz?éèêàâùë><,.|\"'[{]}_-=+*&^%$#@!~";

Additional letters are: éèêàâùë and one additional sign: -.
It should cover most of the cases.

Then, in the html code of my form, I replaced the previous code by this one:
<input value="<?php
$user =& JFactory::getUser();

  if ($user->guest) {
    echo "";
  } else {
     echo $user->name;
    }
?>" class="cf_inputbox required validate-alpha2" maxlength="15" size="30" id="text_7" name="created_by_alias" type="text" readonly="readonly">
<div></div>


It seems to be working well.
If someone have a better idea than hacking the code, I remain interested.
GreyHead 02 Feb, 2011
Hi fredfitaire,

Are you sure you changed chrono_verification.php ?? That's the file use to create the Spam Capthca image. It has nothing to do with validation.

I've posted a link to the thread on validate-alpha here in the last couple of hours.

Bob
fredfitaire 02 Feb, 2011
Yes I confirm ! I don't understand how it could work if the chrono_verification.php file is for the captcha verification, but I confirm it does ! maybe it's because my form is for registered users only and I don't use captcha.

I've seen your reply to a German user, I will do the same within the jsvalidation2.js file to avoid any future problem.

One last question: will it be necessary to hack again my code in case of a CF update release ?
GreyHead 02 Feb, 2011
Hi fredfitaire,

Yes, I'm afraid it will. That's true for any hack to the core code :-(

Bob
fredfitaire 03 Feb, 2011
Your help is much appreciated, you deserve a beer ! Cheers !
This topic is locked and no more replies can be posted.