Hello there. I’ve been using the Static Field Extension in EE 1.6.6 and generally great results - easily setting default values for multiple custom fields and across weblogs as required. However, if I try to set a default value for textarea type custom fields it fails and I get an error (have tried servers with PHP4 and 5 plus older and newer MySQL versions too.)
The error I get is a SQL one since the extension seems to repeat the field id name in the SQL statement when trying to insert a new record on publish (see bold text):
Query: INSERT INTO exp_weblog_data
(entry_id
, weblog_id
, field_id_16
, field_ft_16
, field_id_18
, field_ft_18
, field_id_17
, field_ft_17
, field_id_19
, field_ft_19
, field_id_21
, field_ft_21
, field_id_20
, field_ft_20
, field_id_22
, field_ft_22
, field_id_23
, field_ft_23
, field_ft_27
, field_id_15
, field_ft_15
, field_id_14
, field_ft_14
, field_id_11
, field_ft_11
, field_id_field_id_12
, field_ft_12
, field_id_24
, field_ft_24
, site_id
) VALUES (‘89’, ‘4’, ”, ‘textile’, ”, ‘none’, ”, ‘textile’, ”, ‘none’, ”, ‘none’, ”, ‘none’, ”, ‘none’, ”, ‘none’, ‘xhtml’, ”, ‘textile’, ”, ‘textile’, ”, ‘textile’, ‘30 minutes = $ 40.00\n45 minutes = $ 55.00\n60 minutes = $ 65.00\nAll prices inclusive of GST\n\nFees are subject to change’, ‘textile’, ”, ‘textile’, ‘1’)
Just wondered if anyone has come across the same problem or come up with a solution. It would be great if I could use it for textarea custom fields.
All the best - thanks in advance
Martin
Hi Martin,
Just posted over here - http://ellislab.com/forums/viewthread/96989/ about this but now I’m thinking about it some more. How many fields exactly are you trying to update and what are you placing into them. It may be a character or something which isn’t allowed / supported or maybe whatever you are trying to place into the field is being seen as something that maybe the system thinks is dangerous?
If you can type out just what you are trying to insert into a field and I’ll try it here on an install that I have and see if it botches. We can go from there then to hopefully narrow it down for you.
Best wishes,
Mark
Actually sorry. If this is what you are trying to place into the field :
30 minutes = $ 40.00 45 minutes = $ 55.00 60 minutes = $ 65.00 All prices inclusive of GST *Fees are subject to change
then I just tried that and it all went in fine. Looks like it might be an extension conflict possibly? Is it possible for you to update to 1.6.7 though?
Best wishes,
Mark
Hi Mark, OK useful to know it’s working your end and thanks for the other info and other post - almost certainly an extension clash then; and yes, that was one of the bits of default text I was trying to place - so thanks for the test. I did a workaround for now using the option to have chunks of default text on a drop-down menu within the MD Markitup extension; but I will set it up again at some point since it would be useful to bottom out, and let you know if I pinpoint the clash (which of course may well be MD Markitup because I tend to use that on a lot of textarea fields).
Am using 1.6.7 now - I think 1.6.6 might have been latest version at time of original post.
All the best - and thanks again
Martin
Hi Martin,
Please hold off on what I just said above :-(
I see what you mean now. I had this working on some older sites and it still is but I thought that you meant when you update the Extensions settings page that was when you got the error. I see when it happens now when you actually go to the Publish page and save the entry. Sorry I hadn’t tried that on 1.6.7 I thought you meant the settings page :-(
Sufficed to say not too sure why it’s doing that. Might be a good time to bring Robin in on this one and see if she has any ideas as to why it’s happening.
Will keep an eye on this one as would like to know myself.
OK, will hold off - yes, it looks like it’s definitely broken… :-(
I tried a PM to Robin back in Feb but had no reply - I’m assuming you mean Robin Sowell? I guess he may have been snowed under with EE 2.0 stuff. I might give it a couple of days (he’s probably getting some rest after SXSW) and then try again. I find this extension just SO handy it would be great to get it fixed…
Will update here if I make progress
Kind regards
Martin
I tried a PM to Robin back in Feb but had no reply - I’m assuming you mean Robin Sowell? I guess he may have been snowed under with EE 2.0 stuff. I might give it a couple of days (he’s probably getting some rest after SXSW) and then try again.
He’s actually a she 😉 Looking at that sentence, we all say it but it actually makes no sense at all does it? 😊
I find this extension just SO handy it would be great to get it fixed… Will update here if I make progress Kind regards Martin
I’d definitely say try contacting Robin again and I’m sure she’ll reply. Do let me know what you find out though.
Hope you get something sorted soon.
Best wishes,
Mark
Heh- took me a minute to spot what it was doing to the sql. Odd indeed. In truth- I don’t have that one handy to look at. But if you’ll zip her up and attach it, I’ll take a look. Is field id 12 the static one? Would be my bet off hand. And it breaks with 1.6.7- but works w/1.6.6 and before? (That bit isn’t critical, but if you know off hand….)
Hi Robin,
Heh- took me a minute to spot what it was doing to the sql. Odd indeed. In truth- I don’t have that one handy to look at. But if you’ll zip her up and attach it, I’ll take a look. Is field id 12 the static one? Would be my bet off hand. And it breaks with 1.6.7- but works w/1.6.6 and before? (That bit isn’t critical, but if you know off hand….)
It’s for download on your site 😉
http://media-cow.com/downloads/article/static_field_extension/
Didn’t want to attach it here as you have to register on your site to download so didn’t want to go against that?
I think that it used to work on 1.6.6 can’t be totally sure though. Definitely used to work at some point though.
Best wishes,
Mark
LOL- thanks Mark. My, that thing is ancient. Looks like I had to do backflips on the cp. And… I don’t quite see how it possibly worked on the textarea fields.
This both fixed it and made sense- the static_textarea function:
function static_textarea($field_id, $field_data, $rows, $field_js, $convert_ascii)
{
global $DSP, $IN, $LANG;
$weblog_id = $IN->GBL('weblog_id', 'GP');
$p_type = $IN->GBL('M', 'GP');
if (isset($this->idarray[$weblog_id][$field_id]) AND $p_type == 'entry_form')
{
$field_data = $this->idarray[$weblog_id][$field_id];
$field_id = 'field_id_'.$field_id;
$r = $DSP->input_textarea($field_id, $field_data, $rows, 'textarea', '100%', $field_js, $convert_ascii);
}
Note the last line- $DSP->input_textarea($field_id, as opposed to ‘field_id’.$field_id. Should do the trick. If either of you get a chance to test it out, yell back and let me know if it takes care of it. If it shakes out, I’ll see about getting a fresh zip up tomorrow.
Hi Robin
OK, tested in EE 1.6.7 and a basic textarea field and all seems to be working. Yipeee! Very useful extension IMHO 😊
Thanks a bundle for sorting that I’ve seen it referred to in a quite a few threads here so I think a number of people find this functionality useful. I’d love to see it in the core EE - after all we nearly have that for some fields - for example where you can set default article title prefix…
Just to be clear I never had it working in textarea fields before - I was just lucky the first times I used it and was only setting default values on text input fields; then the first time I tried it on a textarea it failed.
Thanks again
Martin
LOL- thanks Mark. My, that thing is ancient. Looks like I had to do backflips on the cp. And… I don’t quite see how it possibly worked on the textarea fields. This both fixed it and made sense- the static_textarea function:Note the last line- $DSP->input_textarea($field_id, as opposed to ‘field_id’.$field_id. Should do the trick. If either of you get a chance to test it out, yell back and let me know if it takes care of it. If it shakes out, I’ll see about getting a fresh zip up tomorrow.function static_textarea($field_id, $field_data, $rows, $field_js, $convert_ascii) { global $DSP, $IN, $LANG; $weblog_id = $IN->GBL('weblog_id', 'GP'); $p_type = $IN->GBL('M', 'GP'); if (isset($this->idarray[$weblog_id][$field_id]) AND $p_type == 'entry_form') { $field_data = $this->idarray[$weblog_id][$field_id]; $field_id = 'field_id_'.$field_id; $r = $DSP->input_textarea($field_id, $field_data, $rows, 'textarea', '100%', $field_js, $convert_ascii); }
Hi Robin,
Just very quickly replaced the code that was there previously with this and did a quick test and all seems to be fine, thanks for doing that. It’s a really neat little extension that one 😊
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.