1 of 3
1
Using SAEF to Create Weblog Entry
Posted: 04 April 2008 12:16 PM   [ Ignore ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  133
Joined  2008-03-04

I have created a weblog that I would like to be able to create new entries from a Stand-Alone Entry Form (SAEF). I created a SAEF but the formatting on the custom fields is so ugly (and uncontrollable) that it is unusable.

What I imaging being able to do: Have a weblog that members can update by using a FreeForm SAEF. This will create a new entry that can in turn be viewed and updated by means of another Stand-Alone Edit Form.

Is this possible? Am I on track? If so, any directions? Documentation?

Thanks,

Forrest

Profile
 
 
Posted: 04 April 2008 12:43 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3350
Joined  2006-10-18

Forrest, it is possible to use Freeform to submit entries, but it’s also possible to take control of the SAEF. smile

If you’re up to it, you simple just need to hardcode it wink

To start, generate an SAEF as you would with the standard code. View the template, then view the source.
Copy and paste much of that code, and pair some of it up with variables, etc.

{exp:weblog:entry_form weblog="your_weblog" return="template_group/template"}

<input type="hidden" name="allow_comments" value="n" />
<
input type="hidden" name="allow_trackbacks" value="n" />
<
input type='hidden' name='dst_enabled' value='y' />
<
input type="hidden" name="status" value="open" />
<
input type="hidden" name="author_id" value="{logged_in_member_id}" />
<
input type="hidden" id="category[]" name="category[]" value="15" />
<
input type="hidden" name="url_title" id='url_title' value="{url_title}" size="50" maxlength="75" />
<
input name="entry_date" type="hidden" value="{entry_date format='%Y-%m-%d %g:%i %A'}" maxlength="23" />
<
input type="hidden" name="field_ft_7" value="xhtml" />
<
input type="hidden" name="field_ft_8" value="none" />
<
input type="hidden" name="field_ft_9" value="none" />
<
input type="hidden" name="field_ft_10" value="none" />

<
p><label for="form_title">Name</label> <span class="required">*</span><br /><input type="text" name="title" id="form_title" maxlength="150" onKeyUp="liveUrlTitle();" /></p>
<
p><label for="form_location">Location</label><br /><input type="text" name="field_id_10" id="form_location" maxlength="150" /></p>

<
p><label for="form_hole">Hole</label> <span class="required">*</span><br />
<
select name="field_id_9" id="form_hole">
<
option value="" selected="selected">Please Select</option>
<
option value="">--</option>
<
option value="1">1</option>
<
option value="2">2</option>
<
option value="3">3</option>
<
option value="4">4</option>
<
option value="5">5</option>
<
option value="6">6</option>
<
option value="7">7</option>
<
option value="8">8</option>
<
option value="9">9</option>
</
select></p>

<
p><label for="form_club">Club Used</label> <span class="required">*</span><br />
<
select name="field_id_8" id="form_club">
<
option value="" selected="selected">Please Select</option>
<
option value="">--</option>
<
option value="Driver">Driver</option>
<
option value="3 Iron">3 Iron</option>
<
option value="4 Iron">4 Iron</option>
<
option value="5 Iron">5 Iron</option>
</
select></p>

<
p><input type="submit" name="submit" value=" Submit " class="submit" /></p>
<
p><span class="required">* Required Field</span></p>
{/exp:weblog:entry_form}

It’s a form (well, I cut out a bit of it for the example) I have in use for entering Hole-in-One’s for a client (Golf Course)
You can kind of peice together what’s done here....

Let me know if you have any other questions smile

 Signature 
Profile
 
 
Posted: 04 April 2008 12:55 PM   [ Ignore ]   [ # 2 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  133
Joined  2008-03-04

Mr. Pie sir,

Perhaps a few more details will help.

I have a reasonable looking form found here: http://www.grandchestermeadows.com/work/workRequest.php

and I have created a weblog that replicates all the fields. As you can see, the form is mostly text entry fields with two drop-down lists and a submit button.

How do I link the custom field names to the forms fields? Is that the value="field_name" part?

Thank you so much for your help.

Forrest

Profile
 
 
Posted: 04 April 2008 01:06 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3350
Joined  2006-10-18

Forrest,

For whatever reason ExpressionEngine decided this was the best way to go, you need to specify the ID of the custom field name, rather than the “short_name”

So your field names should look like this: field_id_8, field_id_9, field_id_13, etc
The easiest way to find what the actual ID number of the custom field is to view the custom fields in the CP:

CP Home › Admin › Weblog Administration › Field Groups › Custom Fields

It is NOT always the number that’s displayed beside the custom field name…
If you hover your mouse over the custom field, in the Browser where it shows the link URL, at the very end of the URL it will say ...&field;_id=6 (etc)
That is the ID of the field.

So for all custom fields, your form field will look like this (text input for example)

<input type="text" name="field_id_10" maxlength="150" />

The final step is that for EVERY custom field form field, you need to specify what the format of the field is… (matches the same for ID):

<input type="hidden" name="field_ft_7" value="xhtml" />

OR

<input type="hidden" name="field_ft_7" value="none" />

OR

<input type="hidden" name="field_ft_7" value="br" />

 Signature 
Profile
 
 
Posted: 04 April 2008 01:11 PM   [ Ignore ]   [ # 4 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  133
Joined  2008-03-04

Pie Man,

With all due respect the the fine folks on the EE forums, this is the best help I have received on a gnarly issue. I really appreciate it. The instructions are pretty clear so I’ll give it a go and get back with if I have any questions.

Thanks,

Forrest

Profile
 
 
Posted: 04 April 2008 01:15 PM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3350
Joined  2006-10-18

Haha, thanks wink

To be honest, these instructions I gave you are a little weak, but I’m assuming you have some underlying knowledge, etc… haha LOL

I ALWAYS use the SAEF for all of my clients to use for submitting (and editing - with the help of FormHelper) entries, and I always hard-code them. This way you have the most control over appearance, layout, organization, etc.... and showing them an SAEF form like such, generates a LOT less questions than the MAIN control panel would, haha LOL

 Signature 
Profile
 
 
Posted: 04 April 2008 01:19 PM   [ Ignore ]   [ # 6 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  133
Joined  2008-03-04

This is good to know. I do understand the basic directions and of course I know where to find you if I get stuck.

I definitely want to be able to follow up with the edit form as well. I downloaded it and will tackle that next.

Again. Many thanks.

Forrest

Profile
 
 
Posted: 04 April 2008 01:20 PM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3350
Joined  2006-10-18

Forrest,

I will be waiting for you, haha LOL

 Signature 
Profile
 
 
Posted: 04 April 2008 01:22 PM   [ Ignore ]   [ # 8 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  133
Joined  2008-03-04

You can look at my China photos while you wait: http://photo.rouviere.com. smile

Profile
 
 
Posted: 04 April 2008 01:41 PM   [ Ignore ]   [ # 9 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  133
Joined  2008-03-04

Well, I am back sooner than I thought.

In formatting the fields I am following your instructions:

<label for="name">Name:</label>
  <
input type="text" name="field_id_4" value="none" maxlength="128"  /><span class="required">*</span><br />

  <
label for="address">Address:</label>
  <
input type="text" name="field_id_5" value="none" maxlength="128"  /><span class="required">*</span><br />

But in reviewing it on the web, the empty fields are showing the value="none" in the input field: take a look: http://www.grandchestermeadows.com/work/index.php/orders/request2/

Did I miss something?

I just had an idea come to me. Is it possible that the value="none" is for custom fields other than text? And that text fields don’t require a value?

Thanks,

Forrest

Profile
 
 
Posted: 04 April 2008 02:02 PM   [ Ignore ]   [ # 10 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3350
Joined  2006-10-18

Forrest,

The Formatting is an EXTRA form field, and looks like this:

<input type="hidden" name="field_ft_7" value="none" />

(also notice the name is field_ft_7 instead of field_id_7)

Does that make sense? smile

 Signature 
Profile
 
 
Posted: 04 April 2008 02:13 PM   [ Ignore ]   [ # 11 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  133
Joined  2008-03-04

Alas I am missing something here.

All of my fields are custom fields and they are name, address, city, state, zip, etc.

the field Id for name is field Id 4 so does my input go like this:

<label for="name">Name:</label>
  <
input type="text" name="field_ft_4" maxlength="128"  /><span class="required">*</span><br />

If I add value="none" the none show up on the web form.

What now?

Thanks,

Forrest

Profile
 
 
Posted: 04 April 2008 02:43 PM   [ Ignore ]   [ # 12 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3350
Joined  2006-10-18

EVERY custom field line look sort of like this:

<label for="name">Name:</label>
<input type="text" name="field_id_4" maxlength="128" />
<input type="hidden" name="field_ft_4" value="none" />

You’ll notice there’s a Label (optional of course), a Text Input Form field with a name of field_id_# (which is for the the user to fill in), and a Hidden Form Field with a name of field_ft_# (which specifies the formatting of that other field)

Do you notice that for EVERY custom field, there’s TWO form fields, one as the form field that the user fills in the text, one that controls the formatting of that field (hidden).
The names of them are very slightly different… field_ID_4 and field_FT_4

Make sense? LOL

 Signature 
Profile
 
 
Posted: 04 April 2008 03:42 PM   [ Ignore ]   [ # 13 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  133
Joined  2008-03-04

Many thanks. I’ll let you know how it goes.

Forrest

Profile
 
 
Posted: 07 April 2008 12:22 PM   [ Ignore ]   [ # 14 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  133
Joined  2008-03-04

Hi there,

Just wanted to let you know that this is a total success and I am really happy because this is going to completely change my EE life.

Thank you for sharing this with me.

I will have some question about how to edit an entry once it is fully entered, adding more data, changing some fields etc. Should I continue that in this thread or start a new one.

Thanks,

Forrest

Profile
 
 
Posted: 07 April 2008 12:31 PM   [ Ignore ]   [ # 15 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3350
Joined  2006-10-18

Haha,

Well, you’ll now owe me royalties every time you use it rasberry

As for editing… sure, start up a new one in the FormHelper forum smile

 Signature 
Profile
 
 
   
1 of 3
1