Default value for "name" field in submitcontent form?

tomcosm 22 Nov, 2008
Hi There,

A bit of a noobish question, but you all seem like friendly people !

I'm just testing out Chronoforms for a few things, and this submit content form is fantastic! however I would like to simply put "anonymous" as a default value in the name field, so users can just ignore it if they want, but a value will still be added to the database. Here is the current code I copied from the form

<div  class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Your name:</label><input class="cf_inputbox required validate-alpha" maxlength="15" size="30" id="text_7" name="created_by_alias" type="text"><a onclick="return false;" class="tooltiplink"><img  src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" width="16" border="0" height="16"></a><div  class="tooltipdiv">Your name: :: Your nickname as you like it to appear with the story!</div></div><div class="clear"> </div></div>


I'm not quite sure where or how to add this in.

The second question, is I would like the publish and front page values to both be set true when this is submitted, so it doesn't have to be moderated.. it just goes live straight away.

Appreciate the help or pointers on how I can learn this myself.

-Tom
GreyHead 22 Nov, 2008
Hi Tom,

Add a 'value' attribute to the text input
<input class="cf_inputbox required validate-alpha" maxlength="15" size="30" id="text_7" name="created_by_alias" type="text" value='anonymous' />

Bob
tomcosm 22 Nov, 2008
Fantastic, thankyou. Also, I have figured out the published/front page stuff myself.

One more question, is there a way to change the input text box to a simple text box, rather than the one with all the html editing stuff?

Here is the code

<div class="form_item"><div class="form_element cf_textarea" style="width:600px;"><label class="cf_label">Story body:</label>
<?php
$editor =& JFactory::getEditor();
echo $editor->display( 'fulltext', '' , '80%', '350', '55', '20', false ) ;

?>

</div>



Thanks again for your help!
Max_admin 22 Nov, 2008
Hi Tom,

use a normal text area instead:

<textarea name="fulltext"></textarea>


Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
tomcosm 22 Nov, 2008
Solved! Thankyou🙂
stmoist 25 Nov, 2008
Does the value="sometext" trick work with textareas as well?

Edit: I know it doesn't work just by adding the value="", but is there some way to get some text in there, perhaps greyed-out or something?
GreyHead 25 Nov, 2008
Hi stmoist,

No, textareas don't have a value attribute but you can put a default entry between the tags
<textarea . . .>'Some text here</textarea>

Bob
stmoist 25 Nov, 2008
Wow, just as I was editing my previous post. Thank you very much for the prompt response!

Edit again: Is there any way to make it so that the text disappears as soon as the textarea is active/highlighted?
stmoist 26 Nov, 2008
Thank you very much for pointing me in the right direction, Bob!
This topic is locked and no more replies can be posted.