Add the 'data' to the form args so you can validate the form
        data on a get request.
492211
def get_form_kwargs(self):
        
        kwargs = super(ApiFormView, self).get_form_kwargs()
        kwargs['data'] = kwargs.get('initial')
        return kwargs
821216
def post_request(url,args)
      uri = URI.parse(url)
      req = Net::HTTP::Post.new(uri.path)
      req.set_form_data(args)
      request(uri,req)
    end
1299608
def formdata_post(url, fields):
    
    content_type, data = formdata_encode(fields)
    req = urllib2.Request(url, data)
    req.add_header('Content-Type', content_type)
    return urllib2.urlopen(req).read()
1367425
function applyArg(request_url, template_part, actual_part) {
	if (typeof(request_url.args) === "undefined") {
		request_url.args = {};
	}

	if (typeof request_url.args !== "object") {
		throw new Error("The request url's args have already been defined as a " + typeof request_url.args + " and we expected an object. For safety we are throwing this error instead of overwriting your existing data. Please use a different field name in your code");
	}

	request_url.args[template_part] = actual_part;
}
271224
function addParamsToData(IOD, IODOpts, form) {
	form.append('apiKey', IOD.apiKey)

	_.each(exports.prepareParams(IODOpts.params), function(paramVal, paramName) {
		_.each(T.maybeToArray(paramVal), function(val) {
			form.append(paramName, val)
		})
	})
}
615040
def init_form(self, form_data, widget_attrs=None, template=None):
        """"""
        form = self.form(data=form_data)
        form.template = template
        # Attach flow attribute to have access from flow forms (usually to call get_arg_or_attr())
        form.flow = self
        if widget_attrs is not None:
            set_form_widgets_attrs(form, widget_attrs)
        return form
178513
def wrap_form_params(func):
    

    @functools.wraps(func)
    def wrapper(request, *args, **kwargs):
        ctype, pdict = parse_header(request.headers.get('Content-Type', ''))
        if ctype == "application/x-www-form-urlencoded":
            params = {}
            for key, value in parse_qs(request.body.decode("utf-8")).items():
                if len(value) == 1:
                    params[key] = value[0]
                else:
                    params[key] = value

            request.params = merge_dicts(getattr(request, "params", None), params)
            request.form_params = params
        return func(request, *args, **kwargs)
    return wrapper
557779
def get_form_kwargs(self):
        

        kwargs = {}
        for key in six.iterkeys(self.form_classes):
            if self.request.method in ('POST', 'PUT'):
                kwargs[key] = {
                    'data': self.request.POST,
                    'files': self.request.FILES,
                }
            else:
                kwargs[key] = {}
        return kwargs
1029288
def validate_query_params(self):
        """"""
        allowed_params = set(self.get_filters().keys())
        allowed_params.update(self.get_always_allowed_arguments())

        unallowed = set(self.request.query_params.keys()) - allowed_params

        if unallowed:
            msg = 'Unsupported parameter(s): {}. Please use a combination of: {}.'.format(
                ', '.join(unallowed),
                ', '.join(allowed_params),
            )
            self.form.add_error(field=None, error=ParseError(msg))
1077785
def _get_post_data(cls, args):
        ''''''
        if args.post_data:
            return args.post_data
        elif args.post_file:
            return args.post_file.read()
108651
def get_form_kwargs(self):
        
        kwargs = {"initial": self.get_initial()}
        if self.request.method == "GET":
            kwargs.update({"data": self.request.GET})
        kwargs.update({"searchqueryset": self.get_query_set()})
        return kwargs
598344
def form_upload_valid(self, form):
        """"""
        self.current_step = self.STEP_LINES

        lines = form.cleaned_data['file']
        initial_lines = [dict(zip(self.get_columns(), line)) for line in lines]
        inner_form = self.get_form(self.get_form_class(),
            data=None,
            files=None,
            initial=initial_lines,
        )
        return self.render_to_response(self.get_context_data(form=inner_form))
393338
def get_post_form_kwargs(self):
        
        kwargs = {
            'user': self.request.user,
            'forum': self.get_forum(),
            'topic': self.get_topic(),
        }

        post = self.get_post()
        if post:
            kwargs.update({'instance': post})

        if self.request.method in ('POST', 'PUT'):
            kwargs.update({
                'data': self.request.POST,
                'files': self.request.FILES,
            })
        return kwargs
487738
def add_view(self, request, form_url='', extra_context=None):
        ""
        model = self.model
        opts = model._meta

        if not self.has_add_permission(request):
            raise PermissionDenied

        ModelForm = self.get_form(request)
        formsets = []
        inline_instances = self.get_inline_instances(request, None)
        if request.method == 'POST':
            form = ModelForm(request.POST, request.FILES)
            if form.is_valid():
                new_object = self.save_form(request, form, change=False)
                form_validated = True
            else:
                form_validated = False
                new_object = self.model()
            prefixes = {}
            for FormSet, inline in self.get_formsets_with_inlines(request):
                prefix = FormSet.get_default_prefix()
                prefixes[prefix] = prefixes.get(prefix, 0) + 1
                if prefixes[prefix] != 1 or not prefix:
                    prefix = "%s-%s" % (prefix, prefixes[prefix])
                formset = FormSet(data=request.POST, files=request.FILES,
                    instance=new_object,
                    save_as_new="_saveasnew" in request.POST,
                    prefix=prefix, queryset=inline.get_queryset(request))
                formsets.append(formset)
                if inline.inlines:
                    self.add_nested_inline_formsets(request, inline, formset)
            if self.all_valid_with_nesting(formsets) and form_validated:
                self.save_model(request, new_object, form, False)
                self.save_related(request, form, formsets, False)
                args = ()
                # Provide `add_message` argument to ModelAdmin.log_addition for
                # Django 1.9 and up.
                if VERSION[:2] >= (1, 9):
                    add_message = self.construct_change_message(
                        request, form, formsets, add=True
                    )
                    args = (request, new_object, add_message)
                else:
                    args = (request, new_object)
                self.log_addition(*args)
                return self.response_add(request, new_object)
        else:
            # Prepare the dict of initial data from the request.
            # We have to special-case M2Ms as a list of comma-separated PKs.
            initial = dict(request.GET.items())
            for k in initial:
                try:
                    f = opts.get_field(k)
                except models.FieldDoesNotExist:
                    continue
                if isinstance(f, models.ManyToManyField):
                    initial[k] = initial[k].split(",")
            form = ModelForm(initial=initial)
            prefixes = {}
            for FormSet, inline in self.get_formsets_with_inlines(request):
                prefix = FormSet.get_default_prefix()
                prefixes[prefix] = prefixes.get(prefix, 0) + 1
                if prefixes[prefix] != 1 or not prefix:
                    prefix = "%s-%s" % (prefix, prefixes[prefix])
                formset = FormSet(instance=self.model(), prefix=prefix,
                    queryset=inline.get_queryset(request))
                formsets.append(formset)
                if hasattr(inline, 'inlines') and inline.inlines:
                    self.add_nested_inline_formsets(request, inline, formset)

        adminForm = helpers.AdminForm(form, list(self.get_fieldsets(request)),
            self.get_prepopulated_fields(request),
            self.get_readonly_fields(request),
            model_admin=self)
        media = self.media + adminForm.media

        inline_admin_formsets = []
        for inline, formset in zip(inline_instances, formsets):
            fieldsets = list(inline.get_fieldsets(request))
            readonly = list(inline.get_readonly_fields(request))
            prepopulated = dict(inline.get_prepopulated_fields(request))
            inline_admin_formset = helpers.InlineAdminFormSet(inline, formset,
                fieldsets, prepopulated, readonly, model_admin=self)
            inline_admin_formsets.append(inline_admin_formset)
            media = media + inline_admin_formset.media
            if hasattr(inline, 'inlines') and inline.inlines:
                media += self.wrap_nested_inline_formsets(request, inline, formset)

        context = {
            'title': _('Add %s') % force_text(opts.verbose_name),
            'adminform': adminForm,
            'is_popup': "_popup" in request.GET,
            'show_delete': False,
            'media': media,
            'inline_admin_formsets': inline_admin_formsets,
            'errors': helpers.AdminErrorList(form, formsets),
            'app_label': opts.app_label,
            }
        context.update(self.admin_site.each_context(request))
        context.update(extra_context or {})
        return self.render_change_form(request, context, form_url=form_url, add=True)
275905
function prepare ( data, useQs ) {
	var ret;
	if ( !('FormData' in global) || useQs ) {
		ret = qs(data);
	} else {
		ret = new FormData();
		for ( var prop in data ) {
			if ( data.hasOwnProperty(prop) ) {
				ret.append(prop, data[prop]);
			}
		}
	}
	return ret;
}
1171738
def form_valid(self, form):
        
        valid = True
        # 'name' is injected in the clean() of the form line 56
        name = form.cleaned_data.get('name').name
        user = self.request.user
        form.save(user=user, service_name=name)

        sa = ServicesActivated.objects.get(name=name)
        if sa.auth_required and sa.self_hosted:
            # trigger the checking of the service
            from django_th.services import default_provider
            default_provider.load_services()
            service_provider = default_provider.get_service(name)
            result = service_provider.check(self.request, user)
            if result is not True:
                # the call of the API failed due to an error which is in the result string
                # return by the call of the API
                form.add_error('host', result)
                messages.error(self.request, result)
                return redirect('edit_service', pk=self.kwargs.get(self.pk_url_kwarg))

        if valid:
            messages.success(self.request, _('Service %s modified successfully') % name.split('Service')[1])
            return HttpResponseRedirect(reverse('user_services'))
678673
def post(self, request, *args, **kwargs):
        

        # Prepare base
        if 'pk' in kwargs:
            self.object = self.get_object()
        else:
            self.object = None
        form_class = self.get_form_class()

        # Get prefix
        if 'field_prefix' in form_class.Meta.__dict__:
            # Get name from the form
            field_prefix = form_class.Meta.field_prefix
            # Initialize list of fields
        else:
            # Get name from the class
            field_prefix = str(form_class).split("'")[1].split(".")[-1]
        self.field_prefix = field_prefix

        # Build the form
        form = self.get_form(form_class)

        # Find groups
        if 'groups' in dir(self):
            # Save groups
            groups = self.groups
            # Redefine groups inside the form
            form.__groups__ = lambda: groups
            # Initialize list of fields
            fields = []
        else:
            groups = None

        # Add special prefix support to properly support form independency
        form.add_prefix = lambda fields_name, field_prefix=field_prefix: "%s_%s" % (field_prefix, fields_name)

        # Check validation
        valid = form.is_valid()
        if (not valid) and ('non_field_errors' in dir(self)):
            errors = [element[5] for element in list(self.non_field_errors())[:-1]]
        elif form.errors.as_data():
            errors = []
            for element in form.errors.as_data():
                for err in form.errors.as_data()[element][0]:
                    errors.append(err)
        else:
            errors = []

        # For every extra form
        temp_forms = []
        position_form_default = 0
        for (formelement, linkerfield, modelfilter) in self.forms:
            if formelement is None:
                formobj = form
                position_form_default = len(temp_forms)
            else:
                # Locate linked element
                if self.object:
                    related_name = formelement._meta.model._meta.get_field(linkerfield).related_query_name()
                    queryset = getattr(self.object, related_name)
                    if modelfilter:
                        queryset = queryset.filter(eval("Q(%s)" % (modelfilter)))
                    get_method = getattr(queryset, 'get', None)
                    if get_method:
                        instance = queryset.get()
                    else:
                        instance = queryset
                else:
                    instance = None

                # Get prefix
                if 'field_prefix' in formelement.Meta.__dict__:
                    # Get name from the form
                    field_prefix = formelement.Meta.field_prefix
                else:
                    # Get name from the class
                    field_prefix = str(formelement).split("'")[1].split(".")[-1]
                self.field_prefix = field_prefix

                # Prepare form
                formobj = formelement(instance=instance, data=self.request.POST)
                formobj.form_name = form.form_name

                # Excluded fields
                if 'exclude' not in formobj.Meta.__dict__:
                    formobj.Meta.exclude = [linkerfield]
                elif linkerfield not in formobj.Meta.exclude:
                    formobj.Meta.exclude.append(linkerfield)
                if linkerfield in formobj.fields:
                    del(formobj.fields[linkerfield])

                # Link it to the main model
                formobj.add_prefix = lambda fields_name, field_prefix=field_prefix: "%s_%s" % (field_prefix, fields_name)

                # Validate
                valid *= formobj.is_valid()

                # append error
                if not formobj.is_valid() and ('non_field_errors' in dir(formobj)):
                    errors += [element[5] for element in list(formobj.non_field_errors())[:-1]]

            # Save fields to the list
            if groups:
                for field in formobj:
                    # raise Exception (field.__dict__)
                    if 'unblock_t2ime' in field.html_name:
                        raise Exception(field.field.__dict__)
                    fields.append(field)

            # Add a new form
            temp_forms.append((formobj, linkerfield))

        # execute validation specified
        validate_forms = None
        if valid and ("validate" in dir(self)):
            validate_forms = [tform[0] for tform in temp_forms]
            errors = self.validate(*validate_forms)
            # valid = len(errors) == 0
            valid = False
            if errors is None or len(errors) == 0:
                valid = True

        # Remember list of fields
        if groups:
            form.list_fields = fields
            forms = []
        else:
            if validate_forms:
                forms = validate_forms
            else:
                forms = [tform[0] for tform in temp_forms]

        if position_form_default == 0:
            open_tabs = 1
        else:
            open_tabs = 0

        # Check validation result
        if valid:
            # Everything is OK, call valid
            return self.form_valid(form, temp_forms)
        else:
            # Something went wrong, attach error and call invalid
            form.list_errors = errors
            return self.form_invalid(form, forms, open_tabs, position_form_default)