# Help with Complex Sign-Up Process

**URL:** <https://www.ruby-forum.com/t/help-with-complex-sign-up-process/145005>\
**Category:** Rails\
**Created:** [August 5, 2008, 4:00am UTC](https://www.ruby-forum.com/t/help-with-complex-sign-up-process/145005 "2008-08-05T04:00:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Decker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58956e/32.png) [@Decker](https://www.ruby-forum.com/u/Decker)\
**Post date:** [August 5, 2008, 4:00am UTC](https://www.ruby-forum.com/t/help-with-complex-sign-up-process/145005/1 "2008-08-05T04:00:08Z")

</div>

I have a sign-up (new user) process that is – by convention – split  
between a new and create action.

The problem is that the the new view has several hidden divs that are  
conditionally shown during the process of some Ajax callbacks. Here  
is an example. During the sign-up, the user has the choice of  
choosing an existing organization or entering new organization info.  
So the view contains:

\<%= f.collection\_select(“organization”, @orgs, :id, :org\_name,  
{:include\_blank =\> true }, { }) %\>  
\<%= observe\_field “user\_organization”, :url =\> {:action =\>  
“org\_selected”}, :with =\> “org\_id” %\>

If the user chooses an existing organization, my org\_selected Ajax  
action looks like this:

```
org_id = params[:org_id]
if org_id == ""

```

…  
elsif (org\_id == “-1”)  
…  
else  
@org = Organization.find(params[:org\_id])  
render :update do |page|  
…  
page.hide “new\_org”  
page.show “existing\_org”  
page[“existing\_org”].replace\_html :partial =\>  
“existing\_org\_info”  
end  
end

This pattern repeats a few times (for employee position and location  
– both of which are dependent on the company choice). During an Ajax  
callback, a hidden div is shown and a partial is rendered within it.  
The problem I have is that when a validation error occurs in create  
action after the user has filled in all these divs, I have to re-  
render the new view via render action :=\> new, but the divs have lost  
their contents since they were partials rendered during Ajax  
callbacks.

Is there a recommended way to deal with this situation?

TIA
