Maybe I am missing something, but in symfony examples, in form submission action there's nothing which indicates form data is saved to database. (link). How can I save everything to db?
Example from the link:
public function executeSubmit($request)
{
$this->forward404Unless($request->isMethod('post'));
$params = array(
'name' => $request->getParameter('name'),
'email' => $request->getParameter('email'),
'message' => $request->getParameter('message'),
);
$this->redirect('contact/thankyou?'.http_build_query($params));
}
I have a form field in my Rails view like this:
<%= f.text_field :date, :class => "datepicker" %>
A javascript function converts all input fields of that class to a jQueryUI datepicker.
$(".datepicker").datepicker({
dateFormat : "dd MM yy",
buttonImageOnly : true,
buttonImage : "<%= asset_path('iconDatePicker.gif') %>",
showOn : "both",
changeMonth : true,
changeYear : true,
yearRange : "c-20:c+5"
})
So far so good. I can edit the record and it persists the date correctly all the way to the DB. My problem is when I want to edit the record again. When the form is pre-populated from the record it displays in 'yyyy-mm-dd' format. The javascript only formats dates which are selected in the datepicker control. Is there any way I can format the date retrieved from the database? At which stage can I do this?
Thanks,
Dany.
Some more details following the discussion below, my form is spread across two files, a view and a partial. Here's the view:
<%= form_tag("/shows/update_individual", :method => "put") do %>
<% for show in @shows %>
<%= fields_for "shows[]", show do |f| %>
<%= render "fields", :f => f %>
<% end %>
<% end %>
<%= submit_tag "Submit"%>
<% end %>
And here's the _fields partial view:
<p>
<%= f.label :name %>
<%= f.text_field :name %>
</p>
<p>
<%= f.date %>
<%= f.label :date %>
<%= f.text_field :date, :class => "datepicker" %>
</p>
Controller code:
def edit_individual
@shows = Show.find(params[:show_ids])
end
I'm working with the jqGrid and I want to know if exists an event to read a double click in the Editing Form?
Has example: I have a grid with ColumnA and ColumnB. I want read the event when the user perform a double click under ColumnB (In the Editing Form).
Thanks!
I found the solution of my problem ^^
Here is the code, to this example I use the alert "TEST!!!"...
[Thanks to Oleg to wake up my mind :P]
In the colModel
{ name: 'Total_uploads',
index: 'Total_uploads',
width: '100',
editable: true,
edittype: 'text',
editoptions: { size: 10, maxlength: '20',
dataInit: function (el) {
$(el).click(function () {
alert("TEST!!!");
});
}
},
editrules: { required: true },
formoptions: { label: 'Total uploads: ', elmsuffix: ' <span style="color : #0C66BE; font-family: Calibri">(*)</span>' }
}
Hi,
I want to change form attributes with JQuery. In other browsers
it works fine, but not in IE(6,7,8).
Code:
action = '/controller/action/id/';
target = 'upload_iframe';
enctype = 'multipart/form-data';
$('#form1').attr("action",action);
$('#form1').attr("target",target);
$('#form1').attr("enctype",enctype);
So what's the problem ? Your help would be appreciated.
I have a form that validates the email address and I want to be able to place echo '<p class="error">Please enter a valid email address!</p>'; anywhere on the web page without having to put the validation process within the html?
Or should I include the validation process in the HTML form?
Here is the php code.
if (preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $_POST['email'])) {
$email = mysqli_real_escape_string($mysqli, strip_tags($_POST['email']));
} else {
echo '<p class="error">Please enter a valid email address!</p>';
}
This is yet another question about .ico files. I have read through many pages trying to figure this out but I am unable to. When I go to Properties - Application of my Windows Form Application there is a place for me to pick the icon for my application. I have made a 32x32 icon and it takes it just fine, but the image is grainy when it is applied to my .exe file, like it is a picture that has been expanded more than it should have.
1.) Why is this?
2.) Is there any .ico file size other than 32x32 than a Windows Form Application can accept?
I have tried 48x48 but it doesn't like that. I just want my .exe file to look nice!
Are there any tutorials or guides out there that anyone knows of that will show me how to read forms from an external program and get back information about the controls on the form? Currently, I can get the handle to the form, and I can get the class name, but I need to get more information such as a persistent name and contained data. Thanks.
Edit:
I now have a way to read the contained data (with the WM_GETTEXT message), however, I still need a persistent name/ID that I can be sure will not change from instance to instance. One way I can think of for doing this is to take the handle, find the position of the control on the window, and then get the handle from the position from then on. Another way is to determine a static ID for the control and then use that to get the handle from then on. The new scope of my problem is how to implement either of these. Any Ideas?
i am using jqgrid with asp.net-mvc. I have an edit form (using jqmodal) which works great but for some reason one combobox field doesn't default to the current selected row after the first time i bring up the edit form. the weird thing is that i have many other comboboxes which work fine every time and i don't see any real difference.
here is an example of the field that doesn't work:
{ name: "TechOwner", index: "TechOwner", width: 70, editable: true, edittype: "select", editoptions: { dataUrl: "/Person/GetSelectData" }, editrules: { required: true} },
and here is a field that works fine:
{ name: "FundingType", index: "FundingType", align: "left", width: 25, editable: true, edittype: "select", editoptions: { dataUrl: "/Project/FundingGetSelectData" }, editrules: { required: true} },
the dropdown is getting populated with all options (including the current selected row option) but its just defaulting to the top item) instead of one that matches the current row.
is there anything to look out for here that may cause this behavior?
Hello Experts!!!
I've been facing a deployment problem.I've built a WPF application with visual studio 2008 and created an installer(msi) which works fine.But then it's pain to add automatic update to it. i've seen this article at windowsclient.net but it seems to be pretty old but could have been the perfect thing for me.Then i looked at the .Net Application updater block v2.0 which uses enterprise library june 2005 and for some reason it's not installing on my machine.
I thought i will need to use a more recent Enterprise library so i installed and compiled Enterprise 4.1(october 2008) but nothing better happened.To i decided to give a try to CLickonce deployment.After struggling with it, it was almost perfect.I realized that when i was testing the updates provided by the clickonce on my machine which is XP i didn't notice the need of having sqlite dll in the GAC. surely it was already there.I noticed it when i moved to vista that there is a problem.After checking the net i know it's impossible to add a dll to the Global Assembly Cache.
Now i'm stuck, i think i've hit a wall.Can any one share some of his experience? I'm willing to try the updater block if i can get help.
Thanks for reading this!!
I have an MVC 2 application that utilises forms. The required fields within the form are set using attributes that update the model metadata. The form fields are created using the MVC HtmlHelper method : Html.EditorFor.
This works fine so far as validation is concerned, but it seems that by default the required fields are not displayed to the user (for example by appending a * to the control).
If I wanted to provide some custom means of displaying this fact to the user (lets immagine I want to change the background colour of the edit control for example), where is the best place to do it. Would I need to create a custom html helper to replace EditorFor? I tried but it seemed difficult to gain access to the metadata for the correct property. I already have a custom ModelMetaDataProvider so there is no problem adding it there if that is the correct place.
Perhaps this has something to do with it being the mainForm, but I'll ask the question.
I have my mainForm that is the first to load when the program is booted.
I then click a button called Add, which should open a new form, and close the mainForm.
The problem is, is shows the new form for a split second, then closes both.
The code:
private void addFrmBtn_Click(object sender, EventArgs e)
{
saveForm saveform = new saveForm();
saveform.Show();
this.Close();
}
I have to create a form dynamically via javascript (yeah, that sounds ugly, but read this for the reason) and wants to make its submission CSRF proof.
Usually, I use the @csrf_protect decorator in my views, and the {% csrf_token %} tag in my templates, as recommanded in the doc.
But what should I do with a client-side generated form ? If I add a '/get_token/' view to generate a token on the server and obtain its value (say, via JSONP), then that means that I'm creating a backdoor an attacker could use to bypass the protection.
Kinda head-scratching.
What would you recommand ?
Hi expert there, this is my form:
class IPTrackerSearchForm(forms.Form):
keyword = forms.CharField(max_length=100, widget=forms.TextInput(attrs={'size':'50'}))
search_in = forms.ChoiceField(required=False, choices=ANY_CHOICE + MODULE_SEARCH_IN_CHOICES)
product = forms.CharField(max_length=64,widget=forms.TextInput(attrs={'size':'50'}))
family = forms.CharField(max_length=64,widget=forms.TextInput(attrs={'size':'50'}))
temp_result = Merlin.objects.values('build').distinct()
result = [(value['build'], value['build']) for value in temp_result]
build = forms.ChoiceField(choices=ANY_CHOICE + result)
circuit_name = forms.CharField(max_length=256,widget=forms.TextInput(attrs={'size':'50'}))
parameterization = forms.CharField(max_length=1024,widget=forms.TextInput(attrs={'size':'50'}))
metric = forms.CharField(max_length=64,widget=forms.TextInput(attrs={'size':'50'}))
show_in_one_page = forms.BooleanField(required=False, label="Show filtered result in one page", widget=forms.CheckboxInput(attrs={'class':'checkbox'}))
def __init__(self, *args, **kwargs):
super(IPTrackerSearchForm, self).__init__(*args, **kwargs)
temp_result = Merlin.objects.values('build').distinct()
self.result = [(value['build'], value['build']) for value in temp_result]
self.build = forms.ChoiceField(choices=ANY_CHOICE + self.result)
print self.result
With the purpose that, each time I refresh the webpage, when have new record to "build" column in database. It should update to the drop down box "build" here but It never update unless restart the server. I use print and see that ini detect new recrd but can notrefect to build in Class.
Many thanks
I am trying to publish feed through feed form but the feed form doesnot appear. However, the update happens and it happens twice. Also it says "Error thrown by application" in the dialog box.
$message = "has invited you for all for hanging out wid him...the details being..";
//$facebook->api_client->stream_publish($message,null,null,$user,$user);
$attachment = array(
'name' => 'Name',
'href' => 'http://www.facebook.com',
'caption' => 'Caption',
'description' => 'Description');
$attachment = json_encode($attachment);
$action_links = array(array(
'text' => 'Action Link',
'href' => 'http://www.facebook.com'));
$action_links = json_encode($action_links);
$facebook->api_client->stream_publish($message, $attachment, $action_links);
Please tell me what can be done here?
Let's say I have an user registration form. In this form, I have the option for the user to upload a photo. I have an User table and Photo table. My User table has a "PathToPhoto" column. My question is how do I fill in the "PathToPhoto" column if the photo is uploaded and inserted into Photo table before the user is created? Another way to phrase my question is how to get the newly uploaded photo to be associated to the user that may or may not be created next.
I'm using python and postgresql.
i have html form with textarea in which i paste some XML, for example:
<network ip_addr="10.0.0.0/8" save_ip="true">
<subnet interf_used="200" name="lan1" />
<subnet interf_used="254" name="lan2" />
</network>
When user submit form, that data is send to Java server, so in headers i get something like that:
GET /?we=%3Cnetwork+ip_addr%3D%2210.0.0.0%2F8%22+save_ip%3D%22true%22%3E%0D%0A%3Csubnet+interf_used%3D%22200%22+name%3D%22lan1%22+%2F%3E%0D%0A%3Csubnet+interf_used%3D%22254%22+name%3D%22lan2%22+%2F%3E%0D%0A%3C%2Fnetwork%3E HTTP/1.1
how can i use that in my Java applications? I need to make some calculations on that data and re-send new generated XML.
rails - 2.3.8
ruby - 1.8.7
After auto_complete plugin installstion i still have "undefined method `auto_complete_for'" problem!
Andrey-Bezruks-MacBook-Pro:eyeonasia.stage wizeflux$ ruby script/plugin install http://github.com/rails/auto_complete.git --force
svn: '/Users/wizeflux/Projects/ionasia/eyeonasia.stage/vendor/plugins' is not a working copy
Initialized empty Git repository in /Users/wizeflux/Projects/ionasia/eyeonasia.stage/vendor/plugins/auto_complete/.git/
warning: Option "depth" is ignored for github.com/rails/auto_complete.git
From github.com/rails/auto_complete
* branch HEAD - FETCH_HEAD
Andrey-Bezruks-MacBook-Pro:eyeonasia.stage wizeflux$
after restarting server i get an error on line " auto_complete_for :listings, :name " - undefined method `auto_complete_for' for #
Can you recommend a full-text search engine? (Preferably open source)
I have a database of many (though relatively short) HTML documents. I want users to be able to search this database by entering one or more search words in my C++ desktop application. Hence, I’m looking for a fast full-text search solution to integrate with my app. Ideally, it should:
Skip common words, such as the, of, and, etc.
Support stemming, i.e. search for run also finds documents containing runner, running and ran.
Be able to update its index in the background as new documents are added to the database.
Be able to provide search word suggestions (like Google Suggest)
Have a well-documented API
To illustrate, assume the database has just two documents:
Document 1: This is a test of text search.
Document 2: Testing is fun.
The following words should be in the index: fun, search, test, testing, text. If the user types t in the search box, I want the application to be able to suggest test, testing and text (Ideally, the application should be able to query the search engine for the 10 most common search words starting with t). A search for testing should return both documents.
Other points:
I don't need multi-user support
I don't need support for complex queries
The database resides on the user's computer, so the indexing should be performed locally.
Can you suggest a C or C++ based solution? (I’ve briefly reviewed CLucene and Xapian, but I’m not sure if either will address my needs, especially querying the search word indexes for the suggest feature).
Hi,
I've been thinking of implementing this system, but can't help but feel there's a catch somewhere. One of the points of using GUID over incrementing int is that, in the future, if you were to merge databases together, you wouldn't have any clashes over the primary key/identifier. However, my approach is to set the increment size to X where X is the number of servers I'll most likely have in the future. Then, on each server, have the seed be an increment over the seed number on the previous server. That way, during merging, there would be no clashes with the primary key. Is this a safe, normal method or have I gone mental :)?
Thanks
Label label1 = new Label(container, SWT.NULL);
label1.setText("Enter the Password ");
text1 = new Text(container, SWT.BORDER | SWT.PASSWORD);
text1.setText("");
text1.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
if (!text5.getText().isEmpty()) {
setPageComplete(false);
}
}
});
hi, i am creating form using SWT in eclipse can anyone tell me how to validate that form entry above is the sample code of that..actually i want to validate password field it should be minimum length of 6.How to do this please reply.
I need a script to automatically delete the user profile left on ubuntu 9.04, anyone please send me this mail: [email protected] thank you, please indicate how I work not fluent in shellscript.
Hello,
Here's how the situation looks :
I have a couple simple forms
<form action='settings.php' method='post'>
<input type='hidden' name='setting' value='value1'>
<input type='submit' value='Value1'>
</form>
Other small forms close to it have value2, value3, ... for the specific setting1, etc.
Now, I have all these forms placed on the settings.php subpage, but I'd also like to have copies of one or two of them on the index.php subpage (for ease of access, as they are in certain situations rather frequently used).
Thing is I do not want those forms based on the index.php to redirect me in any way to settings.php, just post the hidden value to alter settings and that's all.
How can I do this with JS ?
Cheers
Driving me nuts...
Page with form is encoded as Unicode (UTF-8) via:
<meta http-equiv="content-type" content="text/html; charset=utf-8">
entry column in database is text utf8_unicode_ci
copying text from a Word document with " in it, like this: “1922.” is insta-fail and ends up in the database as â??1922.â?? (typing new data into the form, including " works fine... it's cut and pasting from Word...)
PHP steps behind the scenes are:
grab value from POST
run through HTML Purifier default settings
run through mysql_real_escape_string
insert query into dbase
Help?