SAEF - Hardcoded - Formatting buttons not working
Posted: 01 July 2008 08:45 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  106
Joined  02-08-2008

I’ll have a field/text area selected and it gives the following error:
“In order to use these buttons you must first place your cursor in a field.”

I’m using custom system fields..  what do I need to add other than the formatting_buttons tag?

 Signature 

Unintentionally Vague..  My mind seems to jumble it all up and when it gets spat out it makes perfect sense to me but everyone within earshot is looking at me in this really odd way..  I perpetually struggle to be clear.
 
“Of all the things I’ve lost, I miss my mind the most.” - unknown
 
EE Sites I’ve done: rochesterwriters.com | movingonradio.com | divorcerecoverytoday.com | thirdreader.com | peckishwriter.com | cityjobclub.org

Profile
 
 
Posted: 01 July 2008 10:02 PM   [ Ignore ]   [ # 1 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  04-12-2008

Are you sure you have the field_name attribute in the <textarea name=“field_name” .. /> tag resolving correctly?  I can reproduce this if I misspell the name attribute or, if using Form Helper, misspell the field_name attribute.

 Signature 

“You can’t fall off the floor” - Paul’s Law
“Brawndo, It’s what plants crave!” - Idiocracy

Profile
 
 
Posted: 01 July 2008 11:19 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  106
Joined  02-08-2008

What I’ve currently got:

<textarea name="field_id_6" id="field_id_6" cols="50" rows="9" maxlength="500">

Should it be the short name?

 Signature 

Unintentionally Vague..  My mind seems to jumble it all up and when it gets spat out it makes perfect sense to me but everyone within earshot is looking at me in this really odd way..  I perpetually struggle to be clear.
 
“Of all the things I’ve lost, I miss my mind the most.” - unknown
 
EE Sites I’ve done: rochesterwriters.com | movingonradio.com | divorcerecoverytoday.com | thirdreader.com | peckishwriter.com | cityjobclub.org

Profile
 
 
Posted: 01 July 2008 11:27 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  04-12-2008

If you are using a custom field in a SAEF, then what you have is correct IF indeed the textarea field has an id of ‘6’ and you follow it up with {field_id_6}</textarea>.  If you are using an SAEF with form_helper plugin, you have to have it like:

<textarea name=”{exp:form_helper:field_grabber field_name=‘field_id_6’}”  rows=“20” cols=“70”>{exp:form_helper:field_parser}{field_id_6}{/exp:form_helper:field_parser}</textarea>

although field_parser tag is optional.

You can also use the short name for the field.  The only exception is if you are using the {custom_fields} call and you have multiple textarea custom fields.  I’m starting to guess where I would have to see more code or understand the weblog structure you are implementing to be of more use.

Also, I did find out in messing with a Javascript validation on input fields, that different browsers (specifically IE in my case) interchanges the ID with the NAME input attribute if one isn’t there, where others do not.  Just to be safe, put both ID and NAME makeing them equal to the same value to test.

 Signature 

“You can’t fall off the floor” - Paul’s Law
“Brawndo, It’s what plants crave!” - Idiocracy

Profile
 
 
Posted: 02 July 2008 10:35 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  106
Joined  02-08-2008

The full text area code is this:

<textarea name="field_id_6" id="field_id_6" cols="50" rows="9" maxlength="500"><?php global $_POST; if (isset($_POST['field_id_6'])) echo $_POST['field_id_6']; ?></textarea><input type='hidden' name='field_ft_6' value='none' />

{exp:weblog:entry_form weblog="drt-inspire" return="drt/index" preview="drt/add-inspire"}

{preview}
<TABLE ALIGN="center" BORDER="0" CELLSPACING="0" CELLPADDING="2">
  <
TR VALIGN="top"><TD ALIGN="right"><b>Title:</b></TD><TD ALIGN="left">{title}</TD></TR>
  <
TR VALIGN="top"><TD ALIGN="right"><b>Entry:</b></TD><TD ALIGN="left">{entry}</TD></TR>
</
TABLE>
{/preview}

<TABLE ALIGN="center" BORDER="0" CELLSPACING="0" CELLPADDING="2">
  <
TR VALIGN="top"><TD ALIGN="right"><b>Title:</b></TD><TD ALIGN="left"><input type="text" name="title" id="title" value="{title}" size="50" maxlength="100"><input type="hidden" name="url_title" id='url_title' value="{url_title}" maxlength="75" size="50" /></TD></TR>
  <
TR VALIGN="top"><TD ALIGN="right"><b>Category:</b></TD><TD ALIGN="left">{category_menu}<select name="category[]">{select_options}</select>{/category_menu}</TD></TR>
  <
TR VALIGN="top"><TD ALIGN="right"><b>Entry:</b></TD><TD ALIGN="left">{formatting_buttons}<textarea name="field_id_6" id="field_id_6" cols="50" rows="9" maxlength="500"><?php global $_POST; if (isset($_POST['field_id_6'])) echo $_POST['field_id_6']; ?></textarea><input type='hidden' name='field_ft_6' value='none' /></TD></TR>
  <
TR VALIGN="top"><TD></TD><TD ALIGN="left"><input type="submit" name="submit" value="Submit" /><input type="submit" name="preview" value="Preview" /></TD></TR>
</
TABLE>

<
input type="hidden" name="entry_date" value="{entry_date}" />
<
input type="hidden" name="allow_comments" value="y" {allow_comments} />
<
input type="hidden" name="allow_trackbacks" value="y" {allow_trackbacks} />
<
input type='hidden' name='dst_enabled' value='y' {dst_enabled} />

{/exp:weblog:entry_form}

Thanks for helping me out with this, it’s greatly appreciated.

 Signature 

Unintentionally Vague..  My mind seems to jumble it all up and when it gets spat out it makes perfect sense to me but everyone within earshot is looking at me in this really odd way..  I perpetually struggle to be clear.
 
“Of all the things I’ve lost, I miss my mind the most.” - unknown
 
EE Sites I’ve done: rochesterwriters.com | movingonradio.com | divorcerecoverytoday.com | thirdreader.com | peckishwriter.com | cityjobclub.org

Profile
 
 
Posted: 02 July 2008 01:09 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  04-12-2008

I’ve not use the straight PHP method like you are showing.  I tried the exact same thing getting the same results.  I’m thinking it has to do with it being a textarea.  The Wiki doesn’t give an example of that and others have had to do special call for other non-input type=“text style fields like selects or checkboxes. Edit: that was just plain false, don’t post when tired *shake* sorry.

I’m doing some testing, but I’m there with you using this method.

 Signature 

“You can’t fall off the floor” - Paul’s Law
“Brawndo, It’s what plants crave!” - Idiocracy

Profile
 
 
Posted: 02 July 2008 03:45 PM   [ Ignore ]   [ # 6 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  04-12-2008

Well, I’m afraid my knowledge is too limited with the php method.  My first guess is that the WIKI article is not complete as there has to be more code required other than whats posted since if I do a direct cut-n-paste and only change the term ‘weblog’ to a valid weblog short_name in my DB, it posts like it should, but the formatting buttons does not work.

In looking at the page source, clicking a button calls the taginsert js passing the current object (this), the beginning and closing tag strings.  The taginsert function first does a check against the selField variable, if fols, it complains about the cursor and exits.  When the page loads with the code from the WIKI article or I mirrored yours, the selField variable is false, so it will always pop the error if a button is clicked.

I’m trying to figure out what sets the selField variable to false.

 Signature 

“You can’t fall off the floor” - Paul’s Law
“Brawndo, It’s what plants crave!” - Idiocracy

Profile
 
 
Posted: 02 July 2008 03:54 PM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  04-12-2008

OK, figured it out and had nothing to do with the PHP.  selField variable is set to the field name which the javascript uses to get the field’s value and append the tag(s).  To set this variable,you must add the attribute:

onclick="setFieldName(this.name)"

to the form field tag.  In your case that means:

<textarea name="field_id_6" id="field_id_6" cols="50" rows="9" maxlength="500"
onclick="setFieldName(this.name)">

This took me too long to figure out… I’m too tired.

 Signature 

“You can’t fall off the floor” - Paul’s Law
“Brawndo, It’s what plants crave!” - Idiocracy

Profile
 
 
Posted: 02 July 2008 05:30 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  106
Joined  02-08-2008

You are friggin brilliant.  I honestly never would have figured that one out.

You should edit the wiki entry and update the code sections.

Funny when it’s the really small stuff isn’t it?

 Signature 

Unintentionally Vague..  My mind seems to jumble it all up and when it gets spat out it makes perfect sense to me but everyone within earshot is looking at me in this really odd way..  I perpetually struggle to be clear.
 
“Of all the things I’ve lost, I miss my mind the most.” - unknown
 
EE Sites I’ve done: rochesterwriters.com | movingonradio.com | divorcerecoverytoday.com | thirdreader.com | peckishwriter.com | cityjobclub.org

Profile
 
 
Posted: 02 July 2008 06:02 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  04-12-2008

Done, at bottom of Standalone Form-Hardcoding wiki article.

 Signature 

“You can’t fall off the floor” - Paul’s Law
“Brawndo, It’s what plants crave!” - Idiocracy

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65096 Total Logged-in Users: 57
Total Topics: 82241 Total Anonymous Users: 37
Total Replies: 442010 Total Guests: 282
Total Posts: 524251    
Members ( View Memberlist )