I have a PDF copy of a file for creating a report. Based on this form, we will generate a report.
Is there any way that I can fill out the needed fields on the PDF form using python? How?
I've created a form that posts to a cfm file. When running a script onLoad that fills in the form values and tries to submit...The site takes me back to the login screen.
function f()
{
document.getElementById("email").value = "[email protected]";
document.getElementById("password").value = "asdf";
document.getElementById("form1").submit();
}
Please help!
Question: How can you use the JQuery Auto-Completion plugin to suggest a location ("City, State") for an input field?
Meaning, someone wants to type in "Chicago, IL" ... so they begin typing "Chi" and it auto-suggestions "Chicago, IL".
My biggest hurdles is finding a service that I can query to find out all US city+state names.
I essentially want to do what the StackOverflow "Tags" input form works but form "City, State" auto completion.
I need a generic method for preventing XSS attacks in ASP.NET. The approach I came up with is a ValidateRequest method that evaluates the HttpRequest for any potential issues, and if issues are found, redirect the user to the same page, but in a away that is not threatening to the application. (Source code below)
While I know this method will prevent most XSS attacks, I am not certain that I am adequately preventing all possible attacks while also minimizing false positives. So,
what is the most effective way to adequately prevent all possible attacks, while minimizing false positives? Are there changes I should make to the helper class below, or is there an alternative approach or third party library that offers something more convincing?
public static class XssSecurity
{
public const string PotentialXssAttackExpression = "(http(s)*(%3a|:))|(ftp(s)*(%3a|:))|(javascript)|(alert)|(((\\%3C) <)[^\n]+((\\%3E) >))";
private static readonly Regex PotentialXssAttackRegex = new Regex(PotentialXssAttackExpression, RegexOptions.IgnoreCase);
public static bool IsPotentialXssAttack(this HttpRequest request)
{
if(request != null)
{
string query = request.QueryString.ToString();
if(!string.IsNullOrEmpty(query) && PotentialXssAttackRegex.IsMatch(query))
return true;
if(request.HttpMethod.Equals("post", StringComparison.InvariantCultureIgnoreCase))
{
string form = request.Form.ToString();
if (!string.IsNullOrEmpty(form) && PotentialXssAttackRegex.IsMatch(form))
return true;
}
if(request.Cookies.Count > 0)
{
foreach(HttpCookie cookie in request.Cookies)
{
if(PotentialXssAttackRegex.IsMatch(cookie.Value))
{
return true;
}
}
}
}
return false;
}
public static void ValidateRequest(this HttpContext context, string redirectToPath = null)
{
if(context == null || !context.Request.IsPotentialXssAttack()) return;
// expire all cookies
foreach(HttpCookie cookie in context.Request.Cookies)
{
cookie.Expires = DateTime.Now.Subtract(TimeSpan.FromDays(1));
context.Response.Cookies.Set(cookie);
}
// redirect to safe path
bool redirected = false;
if(redirectToPath != null)
{
try
{
context.Response.Redirect(redirectToPath,true);
redirected = true;
}
catch
{
redirected = false;
}
}
if (redirected)
return;
string safeUrl = context.Request.Url.AbsolutePath.Replace(context.Request.Url.Query, string.Empty);
context.Response.Redirect(safeUrl,true);
}
}
I'm trying to migrate my flat php project to Symfony2, but its coming to be very hard.
For instance, I have a table of Products specification that have several specifications and are distinguishables by its "cat" attribute in that Extraspecs DB table.
Therefore I've created a Entity for that table and want to make an array of just the specifications with "cat" = 0...
I supose the code is this one.. right?
$typeavailable = $this->getDoctrine()
->getRepository('LabsCatalogBundle:ProductExtraspecsSpecs')
->findBy(array('cat' => '0'));
Now how can i put this in an array to work with a form like this?:
form = $this ->createFormBuilder($product)
->add('specs', 'choice', array('choices' => $typeavailableArray), 'multiple' => true)
Thank you in advance :)
#
Thank you all..
But now I've came across with another problem..
In fact i'm building a form from an existing object:
$form = $this ->createFormBuilder($product)
->add('name', 'text')
->add('genspec', 'choice', array('choices' => array('0' => 'None', '1' => 'General', '2' => 'Specific')))
->add('isReg', 'choice', array('choices' => array('0' => 'Material', '1' => 'Reagent', '2' => 'Antibody', '3' => 'Growth Factors', '4' => 'Rodents', '5' => 'Lagomorphs')))
So.. in that case my current value is named "extraspecs", so i've added this like:
->add('extraspecs', 'entity', array(
'label' => 'desc',
'empty_value' => ' --- ',
'class' => 'LabsCatalogBundle:ProductExtraspecsSpecs',
'property' => 'specsid',
'query_builder' => function(EntityRepository $er) {
return $er ->createQueryBuilder('e');
But "extraspecs" come from a relationship of oneToMany where every product has several extraspecs...
Here is the ORM:
Labs\CatalogBundle\Entity\Product:
type: entity
table: orders__regmat
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
name:
type: string
length: 100
catnumber:
type: string
scale: 100
brand:
type: integer
scale: 10
company:
type: integer
scale: 10
size:
type: decimal
scale: 10
units:
type: integer
scale: 10
price:
type: decimal
scale: 10
reqcert:
type: integer
scale: 1
isReg:
type: integer
scale: 1
genspec:
type: integer
scale: 1
oneToMany:
extraspecs:
targetEntity: ProductExtraspecs
mappedBy: product
Labs\CatalogBundle\Entity\ProductExtraspecs:
type: entity
table: orders__regmat__extraspecs
fields:
extraspecid:
id: true
type: integer
unsigned: false
nullable: false
generator:
strategy: IDENTITY
regmatid:
type: integer
scale: 11
spec:
type: integer
scale: 11
attrib:
type: string
length: 20
value:
type: string
length: 200
lifecycleCallbacks: { }
manyToOne:
product:
targetEntity: Product
inversedBy: extraspecs
joinColumn:
name: regmatid
referencedColumnName: id
HOw should I do this?
Thank you!!!
Hi,
I have a parent form, with some child windows (not forms - just windows, for example label controls) inside it. Under certain circumstances, I want one of those child windows to be drawn "above" the others, to display a message over the entire main form.
I've tried setting HWND_TOPMOST and HWND_TOP on the child windows, but it doesn't seem to have any effect at all. Am I doing something wrong, or do HWND_TOPMOST and HWND_TOP only work on forms, as opposed to controls within forms?
Thanks.
i have a combobox on a form
i want the text of the combobox to be passed into a query.
my query is:
select..from..where something=[Forms]![Enter Data]![comboCup]
the form name is enter data and the combobox name is combocup. should i do:
[Forms]![Enter Data]![comboCup]![text]
or
[Forms]![Enter Data]![comboCup]![value]
??
where find topic with description of setters and getters of form fields?
example:
field:
<?php echo $form->textField($model,'tagsArray',array('size'=>60,'maxlength'=>255)); ?>
getter:
function getTagsArray()
If I have a map of three countries, and their borders form the outline of a sea, is their a way with SVG to give that bound area attributes and style?
Another example might be three triangles which form a third triangle in the center (like the triforce). If someone wanted to make that middle empty area glow (or whatever)...
Hi.
I'm using struts2, now in my jsp file i've got 2 variables:
${server_address}
${pageContext.request.contextPath}
Now i want to connect it in my tag:
<s:form action="%{server_address}%{pageContext.request.contextPath}/actionName.action">
But generated output looks like that:
<form method="post" action="http://10.0.0.5:8088/actionName.action" name="actionName" id="actionName">
There is no contextPath... How can i connect this two variable ?
In Clojure, a map entry created within a macro is preserved...
(class (eval `(new clojure.lang.MapEntry :a 7)))
;=> clojure.lang.MapEntry
...but when piped thru from the outside context collapses to a vector...
(class (eval `~(new clojure.lang.MapEntry :a 7)))
;=> clojure.lang.PersistentVector
This behavior is defined inside LispReader.syntaxQuote(Object form) condition if(form instanceof IPersistentCollection).
Does anyone know if this is intended behavior or something that will be fixed?
I have created a pdf using tcpdf in php. i have a table with one row and one column. when i put the content from a form which is a textarea, the content in the form flows out of the table border. how can i make it so that it is contained in the border itslef???
I m havin a jqueryui modal form. and i m using jquery cluetip tool tip plugin but tool tip is not working in a proper way on modal window form.. this is the screen shot ...
Star is showing the place where tool tip must be there and arrows are showing the place where tool tip is showin.. can any body tell me how to figure this out..
I am using the .live function to fire of a function aaa(). Unable to fire the function because code does not reach alert msg
The structure of my html
is
body id="plants"
form id= flower method="post"
div class= "rose"
div class= "red"
ul id = "colors"
li
a
li
a
li
a
Cuurently I am using
$( 'body#plants form#flower div.rose div.red ul#colors li a' ).live('click', function(){
alert('code reaches');
aaa();
});
How can I get this to work?
Using Appcelerator:
I have a form, a tableView with textFeilds
I want it so when I focus on them, it slides the window or the view to the top, under the navigation bar.
Right now, the keyboard is blocking the last few rows.
Do I need a listener on each form to slide? If so how do you do that?
Hi.
I'm looking for a way to customize display of spring MVC tags from this taglib:
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
Is there a way to customize display of those tags as in Struts2 .ftl templates?
Hello
I moved my access apllication from DAO into ADO connection. It works better but I am encountering a problem when I enter a value in a form's field then I push the tab button
the screen takes me to the first fields of the form and I lose my activecontrol which is the control of the field in which i enter the value.
N.B.: If I clicked the cursor using the mouse after applying the value in the specified field, it works properly...
Any help will highly appreciated
I have the string with URL. For example "http://google.com".
Is there are any way to download and render this page to picture file? ("test.jpg")
I tried to use WebBrowser control, to download and render picture, but it only works when WebBrowser placed in displayed form. In other ways it's render only black rectangle.
But i want to render picture without any visual effect (creating, activating form etc.)
i have web form running in asp.net & c#.net,
The form has a devexpress aspxtextbox and the another ordinary textbox with a button.
The scenario is enter a text longer than the width of the text box in the ordinary text box.
on clicking the button it enters the text in to devexpress aspxtextbox ,increasing the width of the devexpress aspx text box inspite of width given as 50 px.
how to maintain the fixed width for devexpress aspx text box
I have several articles about Dependency Injection, and I can see the benefits, especially when it comes to unit testing. The units can me loosely coupled, and mocking of dependencies can be made.
The trouble is - I just don't get where to start.
Consider this snippet below of (much edited for the purpose of this post) code that I have. I am instantiating a Plc object from the main form, and passing in a communications mode via the Connect method.
In it's present form it becomes hard to test, because I can't isolate the Plc from the CommsChannel to unit test it. (Can I?)
The class depends on using a CommsChannel object, but I am only passing in a mode that is used to create this channel within the Plc itself. To use dependancy injection, I should really pass in an already created CommsChannel (via an 'ICommsChannel' interface perhaps) to the Connect method, or maybe via the Plc constructor. Is that right?
But then that would mean creating the CommsChannel in my main form first, and this doesn't seem right either, because it feels like everything will come back to the base layer of the main form, where everything begins. Somehow it feels like I am missing a crucial piece of the puzzle.
Where do you start? You have to create an instance of something somewhere, but I'm struggling to understand where that should be.
public class Plc()
{
public bool Connect(CommsMode commsMode)
{
bool success = false;
// Create new comms channel.
this._commsChannel = this.GetCommsChannel(commsMode);
// Attempt connection
success = this._commsChannel.Connect();
return this._connected;
}
private CommsChannel GetCommsChannel(CommsMode mode)
{
CommsChannel channel;
switch (mode)
{
case CommsMode.RS232:
channel = new SerialCommsChannel(
SerialCommsSettings.Default.ComPort,
SerialCommsSettings.Default.BaudRate,
SerialCommsSettings.Default.DataBits,
SerialCommsSettings.Default.Parity,
SerialCommsSettings.Default.StopBits);
break;
case CommsMode.Tcp:
channel = new TcpCommsChannel(
TCPCommsSettings.Default.IP_Address,
TCPCommsSettings.Default.Port);
break;
default:
// Throw unknown comms channel exception.
}
return channel;
}
}
I'm somewhat new to grails (not groovy though) and I'm working on a sample CRUD application. The issue I'm trying to solve is how to set a property on a bean based on a radio button before I update it in the database. Is the Form Helper http://www.grails.org/plugin/form-helper plugin the way to go? Will the bean have its value set regardless of if the button is actually clicked by the user or if it is left at its default value?
thanks,
Jeff
I have a Panel on windows Form with few controls inside panel,
Can i make panel completely transparent.
(It should give the feel that controls are placed directly on Form)
I'm tying to hide my slug fields in the admin by setting editable=False but every time I do that I get the following error:
KeyError at /admin/website/program/6/
Key 'slug' not found in Form
Request Method: GET
Request URL: http://localhost:8000/admin/website/program/6/
Exception Type: KeyError
Exception Value:
Key 'slug' not found in Form
Exception Location: c:\Python26\lib\site-packages\django\forms\forms.py in __getitem__, line 105
Python Executable: c:\Python26\python.exe
Python Version: 2.6.4
Any idea why this is happening
Anyone know of a working sample of jquery axax post with validation messages being returned from the server that highlight the relevant form fields?
Should the form be a partial view? Is it possible to make use of modelstate?
Cheers