Drupal 6.9
Using APK and Content Profile

When following the link (e.g., "Filling out
will bring profile to xx%"), module doesn't accept input as valid.

Valid input is entered, but when the user hits "save," "Please complete the fields" error is generated and data isn't saved. Pretty major bug.

CommentFileSizeAuthor
#14 content_complete-372795.patch912 bytesphdhiren

Comments

pvhee’s picture

Status: Active » Postponed (maintainer needs more info)

Data editing is not altered by this module, it only will give you the message "Please complete the fields" but won't actually do something. We either need more info on this, or I think its most likely generated by one of the custom modules. Anyone something similar with the described setup?

bcobin’s picture

Just to clarify (with Content Profile):

1. Under the Profile "thermometer," it says,"Filling out
will bring Profile to xx%." - Good!

2. Clicking on link will take you to Profile page, with the message, "Please complete the fields." - Good!

3. The field(s) in question is/are highlighted - Excellent!

4. Fill in the field(s) and hit "save"

Result: The page goes back to Step 2 and the information isn't saved - Bad!

Thanks for the module and for the quick response - looks like a "logic" thing... hoping somebody can resolve this - it's a great module!

pvhee’s picture

It seems the use of form_set_error to flag a field as incomplete is creating a problem for your specific installation:

$fieldname = $_GET['content_complete_fieldname'];
form_set_error($fieldname, t('Please complete the fields.'));

This is rendered for every form that has an argument 'content_complete_fieldname' in the URL.

I used the form_set_error more for convenience (displaying a user message + showing a red line around the box to be completed), and it shouldn't actually fail validation, although I am not entirely sure of that...

bcobin’s picture

Thank you SO much for your help - per your suggestion, I changed form_set_error to drupal_set_message and the form now does validate. I can hit "save," which is a big improvement! (Although having the field in question outlined in red was very cool and I miss it.)

But hey - I'll take it!

Now, here's the other problem in how I'm using it (with APK, which I'm sure other people will do):

I'm invoking Content Complete from a panel set (APK) - not a node. So when the field is completed, it sends the user to the node (node/xxx) which is a subset of everything in APK, not back to the panel set from whence he/she came (user/uid). The user will think they "broke" their profile somehow.

Is there a generic way to send the user back to the previous page once they've updated their information? Thanks again for your help!

gsquirrel’s picture

I also get the same problem - when following a link to fill out one of the missing fields the form wont work, the field isn't saved and displays the "Please complete the fields." message. Since it doesn't happen when you go to the normal edit page without the extra destination in url from the content complete link it must be to do with that. Will try the fix suggested above.

Am also using APK so that may be related, but not sure what difference it makes.

Would also be interested in knowing if the user can be redirected back to the panel they started on rather than node page.

Thanks

pvhee’s picture

I tried to replicate the problem with advanced_profile and content_profile. However everything seemed to work fine.

Can anyone specify better the problem, or describe in detail the setup? It might have something to do with the type of form element, so far I only tested with a textfield.

floretan’s picture

Status: Postponed (maintainer needs more info) » Active

I'm having the same issue using content_profile.

form_set_error() is used by validation handlers to notify the forms API that the form failed validation, so it will keep the form from being submitted.

I'll take a look at what might be causing this to happen only in certain cases, but I would recommend not using form_set_error().

pvhee’s picture

I used form_set_error to draw a red bar around the field that needs to be completed.

An alternative is to use the class ID of the field and draw a red line around the field with inline JS (like in the pcp module, line 92). For Content Complete however the fields are more diverse (CCK fields, or core title/body), and it is more complex to get the correct field names. form_set_error did the heavy lifting for me, but apparently in certain circumstances this does not validate anymore (although I never managed to replicate it myself).

If you have an idea of how to do this without form_set_error, I would be glad to know.

pvhee’s picture

Status: Active » Postponed (maintainer needs more info)
rsantiag’s picture

Hi,

I'm having the same problem. The field isn't updated.

I think the problem appears because the generated form, when the "follow link" was clicked, has the same url as the form action URL of this form. An example:

I click over the Block link "fill up name ..." and then I'm redirected to a url like this "http://www.mydomain.com/node/367/edit?content_complete_fieldname=field_name". The field "name" is inside a red box, and I can see a message in order to complete the field. If you look for the destination url form, you can see something like this: '

Hope this can help to resolve the issue!!

Great job any way!!
Ricardo

altparty’s picture

Same problem here. I'm using Content Profile and Panels to display a profile page with two content types.

Changing form_set_error to drupal_set_message solves the problem of not saving the node. But now the field-name is displayed on top of node, and that's not really cool. So, are there any other alternatives?

Anyway, thanks for this wonderfull module.

tandersonmd’s picture

Subscribing.

phdhiren’s picture

Title: Does not accept update when link followed » Node does not get updated when followed the link of content_complete block
Status: Postponed (maintainer needs more info) » Active

Thanks for the great module.

I'm using the Drupal 6.12 and have couple of content type which have been marked as content profile.
Whenever we follow the "Filling out FIELD NAME will bring CONTENT TYPE NAME to xx%"
and even if we fill or not fill that FIELD NAME, the node does not get updated. It constantly throws an error of "Please complete the fields."

If we do comment the line of form_set_error

  $fieldname = $_GET['content_complete_fieldname'];
   //form_set_error($fieldname, t('Please complete the fields.'));

It works.

But we also need to have another way out to prompt the user to fill that FIELD NAME. Also making sure It is not to make it required field (If it is optional in the defination)

phdhiren’s picture

Component: User interface » Code
Status: Active » Patch (to be ported)
StatusFileSize
new912 bytes

I was just working around it and found that on form submit it also calling the form_set_error

Just checkout the patch attached. It works for me.

pvhee’s picture

Status: Patch (to be ported) » Fixed

Thanks for the patch, this will likely solve the problem, and I've committed it to dev. I'm marking this issue as fixed.

phdhiren’s picture

Thanks for applying it to dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.