hi,
Thanks for replying for my post about retrieval of profile2 fields. I have this task,anonymous user can able to view the form but should redirect to user login page or say a message like create new account if they need to submit the form. i published the webform.. i gave permission to view the webform for anonymous users. but they are able to submit if they can view. if i remove the permission they cant even view the form. please help me..
thanks in advance..

Comments

quicksketch’s picture

If you were able to deny the user access to submit, their data would definitely be lost while they went to go sign up for an account. Would it be okay that users have to completely fill out the form again after they have an account?

I can't think of a way to do this using the built-in validation, nor with the Webform Validation module. You could however, accept the submission anyway and just tell the user to sign-up for an account in the confirmation message. You can theme the confirmation message as described in THEMING.txt to show a different message based on if the user was logged in or logged out.

If you really want to show the form even if a user can't fill it out, it's possible with custom code. You'd have to place some code similar to this in an a hook_node_view():

$node->content['webform'] = drupal_get_form('webform_client_form_' . $node->nid, $node, NULL);

Though as stated in the submission guidelines, I generally don't help with custom coding solutions, so you may need to take it from there.

gopisundar’s picture

thnks a lot for your valuable information about the post. but i am a newbee.. so coding is difficult.. the first thing what you said is ok for me.. the data getting lost when they go for sign up is not a problem.. anonymous user should not sumbit until and unless they register.. the theming idea u said about, i tried. but it reflects for all users(authenticated too).. is there any possible way to implement the first two lines u said about..?
thanks in advance.

quicksketch’s picture

Unfortunately I don't provide custom coding support in the Webform issue queue.

gopisundar’s picture

Thanks a lot for helping upto this quicksketch.i will try to pick up from here. but atleast can u give me idea or clue how to do this.. i dont need the code.. i will try my own thing..please.
thanks in advance.

gopisundar’s picture

i tried to work with theming part. the confirmation template file has three variables.. $sid,$confirmation message,$node. but i tried with 'uid' so that i can check if user is login or not by setting this value to 0($user->uid==0), so that i can concentrate on anonymous user.. but this is not working..i do no how to start with this. quicksketch please help with this..
thanks in advance..

quicksketch’s picture

Status: Active » Closed (won't fix)

As mentioned in the submission guidelines, I don't provide help with custom coding:

Any issues regarding "how do I code ..." or "how do I theme ..." will not be answered. Please look elsewhere for coding resources.

Please refer to other resources such as IRC or Drupal StackExchange to ask your questions.