Replying to my own message - problem solved - ignore previous posting! I forgot to include my variables in my response so expected values were not being passed - I was doing this:
variables = RequestContext(request, { 'form': form, 'caller': caller, 'error': error }) return render_to_response('search.html') instead of: variables = RequestContext(request, { 'form': form, 'caller': caller, 'error': error }) return render_to_response('search.html', variables) Just another brain fart at my end. Sometimes I just can't see the wood for the trees<g>! On Apr 12, 1:21 pm, BrendanC <bren...@gmail.com> wrote: > I have a reusable search form and want to display a different form > header based on where/how the search is called from (I get this from > the url). In the search template I'd like to test a variable to > determine which header to display. I need to somehow pass variable > from the view the template - something like this: > > form = SearchForm({'Retired' :'Retired Staff''}) > > then in the search template check the Retired variable : > > <p/> > {% if Retired %} > <h3> Search Retired Staff List.</h3> > {% endif %} > </p> > > The generic search form class is" > class SearchForm(forms.Form): > > # Create a Search Form - set form header to value passed by > caller > > query = forms.CharField( > label=u'Search by Employee ID ', > widget=forms.TextInput(attrs={'size': 32}) > ) > > The catch here is that the variable is not a field on the form. So how > can Ito pass context info at form creation time? Is this possible? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.