⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

[SOLVED] Set Data Type doesn't work properly - Deletion on Update



Ruedische

Ruedische
  • profile picture
  • Member

Posted 18 April 2012 - 17:45 PM

In my database table is a field with the MySQL-Type "Set". When I update a record, this field will always be deleted. Is there a quick fix? BTW: Enum-types work well.

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 18 April 2012 - 19:08 PM

I will look at it and I will inform you as soon as possible. What browser do you use?

Ruedische

Ruedische
  • profile picture
  • Member

Posted 18 April 2012 - 19:22 PM

I'm using Firefox 11 on Win XP. Inserting data with multiple select SET-field works fine. But while editing a record, the selected options are always getting cleared - they are indicated in the form (which can be seen in the HTML source code), but after saving they are gone.

<div class='form-input-box' id="quartal_input_box">
<select multiple onchange="var v = ''; for (var i in this.options) if (this.options[i].selected) v += (v == '' ? '' : ',') + this.options[i].value; this.nextSibling.value = v;"><option value='1' >1</option><option value='2' selected='selected' >2</option><option value='3' >3</option><option value='4' selected='selected' >4</option></select><input type='hidden' name='quartal' /> </div>
<div class='clear'></div>

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 18 April 2012 - 19:38 PM

OK I wil look at it and l will fix that as it is really important bug and I will have a fix for that. Probably I will have a quick express release for that at version 1.2.1.1 . I will inform you for any changes. Thanks to mention it and sorry for this.

Ruedische

Ruedische
  • profile picture
  • Member

Posted 18 April 2012 - 19:43 PM

In addition: It doesn't work in IE 8 and Chrome (not even insert). Safari and Opera show the same behavior as Firefox (all on Win - latest browser versions; except IE of course).

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 18 April 2012 - 21:34 PM

Sorry for that. The set type was a contribution code and I didn't tested properly. You can look at the changes at: https://github.com/s...4ffa6487306d200 or you can simply just download and replace the library grocery_crud with this one: [attachment=111:grocery_crud.php]

Now this works fine for ALL the browsers and OS systems and in IE 8 too.

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 18 April 2012 - 22:13 PM

I edited your title so we can help more people with a similar problem.

Kenta Saito

Kenta Saito
  • profile picture
  • Member

Posted 19 April 2012 - 00:46 AM

I am very sorry. My code made users a problem.
And Johnny. Thank you for fix that.

Ruedische

Ruedische
  • profile picture
  • Member

Posted 19 April 2012 - 06:35 AM

Muchas gracias for the quick fixing of that issue!

Ruedische

Ruedische
  • profile picture
  • Member

Posted 19 April 2012 - 07:45 AM

Oh, I'm sorry, but there is now another problem. I've replaced the library file, now I get PHP Errors (Notices), and my Input-Fields look weird (kind of shrinked). After Updating the result message appears inside a textarea.

A PHP Error was encountered
Severity: Notice
Message: Undefined index: form_inactive
Filename: libraries/grocery_crud.php
Line Number: 2916
A PHP Error was encountered
Severity: Notice
Message: Undefined index: form_active
Filename: libraries/grocery_crud.php
Line Number: 2916

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 19 April 2012 - 08:07 AM

This is a fix only for grocery CRUD version 1.2.1 So just update your version to 1.2.1.1 and copy ALL the files and folders to your project. Just go to the http://www.grocerycrud.com/downloads and download the latest one.

Ruedische

Ruedische
  • profile picture
  • Member

Posted 19 April 2012 - 11:40 AM

I thought so and did an update. Error messages are gone, also the CSS weirdness, but the success-message after updating a record (with a set-field) appears only in a teaxtarea-field (Firefox used). This is strange. - After updating nothing else is shown on the page. This is even stranger.


[attachment=115:grocery_crud_update_with_set_field.png]

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 19 April 2012 - 17:51 PM

This is not weird for me. You defenetly have problem with your Javascript. So [color=#282828][font=helvetica, arial, sans-serif] the CSS weirdness and the textarea means that your javascript doesn't work properly. Please try again for a last time to copy all the files included the themes file. If again it doesn't work then can you attach your firebug console (with the error) because you have for sure a Javascript error, but I don't know why. So for example I need something like this: [/font][/color][attachment=116:error-in-firebug.png]

Ruedische

Ruedische
  • profile picture
  • Member

Posted 20 April 2012 - 15:45 PM

Since yesterday I've made some changes in my application. I didn't use the set data type anymore ... Now I've changed back from varchar to set - and it works! Maybe, there was a typo in my script (required fields ... unset texteditor), who knows. THX for grocerycrud. It helped me a lot.

One suggestion:
I don't use TinyMCE, so it would be nicer to have the texteditor unset by default instead of set. I 'm using Textile-Markup (Textile Class from Textpattern) and have second columns for HTML (parsed textile) in my database (filled by callback function). Textile is only for backend. Frontend code reads the HTML columns. Why Textile? I need definition lists. They are easy in textile (; dd :dt), Tiny sucks.