After validation, i got error and return back to :action = :new.
Some field on form already filled, so i want to keep them filled afterr error message too.
How it can be done?
Thanks.
I have an ASP pg with a formview list control on it that hooks up to a sql database customer table
I want to access the customer name outside the form.
How do I:
A) access the bound text box in the form view template? Something like Text1.text=formview1.customername.text (that doesn't work but that's the kinda thing)
B) access the database field in the table that the sqlsource connects to to feed the formview
Really appreciate the help. I bet it's easy to do but I'm just not getting there.
Hi
In my mode I am selecting a field as
$query1 = $this->db->query("SELECT dPassword
FROM tbl_login
WHERE dEmailID='[email protected]'");
How to return dpassword as a variable to my controller
I tried this way return dpassword;
I have the following models in my Django app. How can I from the Team model find all the User objects who have accepted as True in the Membership model? I know I need to use Team.objects.filter(), but I'm not sure how to check the value of the accepted field.
from django.contrib.auth.models import User
class Team(models.Model):
members = models.ManyToManyField(User, through="Membership")
class Membership(models.Model):
user = models.ForeignKey(User)
team = models.ForeignKey(Team)
accepted = models.BooleanField(default=False)
Why is that when I search a row in my database, it ended up 0 results? In fact, there are rows that meet my search criterion when I view them manually, but the search button doesnt work as it is. Heres how
you can see there are rows that have '0000-00-00 00:00:00' in them, but when I used the search feature, it ended up like this:
take note that Im entering it in the right field which is 'AcctStopTime'.
TIA
In one of my HTML page dynamically loading some file field while clicking a button like follows
$('#add').click(function(){
$('#files').append('<input type="file" class="myfile" name="myfile" />');
});
My question is how to "bind" newly added element to HTML page so that I can access like
$('.myfile').change(function(){
// Code Here
});
I am asking this because
$('.myfile').live('change',function(){
// Code here
});
not working in all browsers , expecially IE
Please help thanks
Hi everyone,
I have a simple text_field in my form where a user enters a time in minutes, i.e. 60.
How can I multiply that number by 60 before saving the form, such that the database stores the number in seconds?
Then, how do I reverse that and show the field in minutes on another view?
Thank you!
hi,
i have a blog application were Post belongsTo Category and Category hasMany Post
Post can have a Category or not - in latter case NULL value is present in Post.category_id field.
Now i would like to have following category count with single SQL query
category|post_count
--------------
PHP | 2
JavaScript | 4
SomeOtherCat | 1
NULL | 3
The clue here is that i also want to count posts without category (NULL row above). Is it posibble with one SQL query?
Hi !
In Python, I have the following example class :
class Foo:
self._attr = 0
@property
def attr(self):
return self._attr
@attr.setter
def attr(self, value):
self._attr = value
@attr.deleter
def attr(self):
del self._attr
As you can see, I have a simple "private" attribute "_attr" and a property to access it. There is a lot of codes to declare a simple private attribute and I think that it's not respecting the "KISS" philosophy to declare all attributes like that.
So, why not declare all my attributes as public attributes if I don't need a particular getter/setter/deleter ?
My answer will be :
Because the principle of encapsulation (OOP) says otherwise!
What is the best way ?
Thanks !
My code does not update the thread field. It is null. Anyone have any ideas?
INSERT INTO [Messages]([Sender], [Receiver], [Job_Number], [Subject], [MessageText], [DateSent])
VALUES(@Sender, @Receiver, @Job_Number, @Subject, @MessageText, @DateSent)
SET @ThreadID = SCOPE_IDENTITY()
UPDATE [Messages]
SET Thread = @ThreadID
WHERE MessageID = @ThreadID
I'm trying to iterate a bunch of SELECT OPTION html drop-down fields and from the ones that are NOT empty, take the values and add a hidden field for a PAYPAL shopping cart.
My problem is that for some reason, the variable "curitem" is not passed inside the each function and I can't add the hidden field like they should. All I get is "NaN" or "undefined".
What PAYPAL expect is : item_name_1, item_name_2, etc. All numbers must iterate by +1.
How can I do this?
Thanks a bunch in advance
var curitem;
$.each($("select"), function(index, item) {
var attname = $(this).attr("name");
var nom = $(this).attr("data-nom");
var prix = $(this).attr("data-val");
var partname = attname.substring(0, 1);
var qte = $(this).val();
// i want all my <select option> items that the NAME start with "q" AND have a value selected
if (partname == "q" && isNaN(qte) == false && qte > 0) {
// item name
var inp2 = document.createElement("input");
inp2.setAttribute("type", "hidden");
inp2.setAttribute("id", "item_name_"+curitem);
inp2.setAttribute("name", "item_name_"+curitem);
inp2.setAttribute("value", nom);
// amount
var inp3 = document.createElement("input");
inp3.setAttribute("type", "hidden");
inp3.setAttribute("id", "amount_"+curitem);
inp3.setAttribute("name", "amount_"+curitem);
inp3.setAttribute("value", prix);
// qty
var inp4 = document.createElement("input");
inp4.setAttribute("type", "hidden");
inp4.setAttribute("id", "quantity_"+curitem);
inp4.setAttribute("name", "quantity_"+curitem);
inp4.setAttribute("value", qte);
// add hidden fields to form
document.getElementById('payPalForm').appendChild(inp2);
document.getElementById('payPalForm').appendChild(inp3);
document.getElementById('payPalForm').appendChild(inp4);
// item number
curitem = curitem + 1;
}
});
I have an array of field names. I would like to use those to populate the keys of another array, which will have empty values as default. Is there a single command I can do this with?
I have some doubt as follows
We are UPDATING a field in SQL and ALTER the row also.After giving the COMMIT command the system is crashed.Wat will happen to the commands given,whether it will UPDATE and ALTER the table r not?
i am connecting to a mysql database through excel using odbc
what does this line do?
Set rs = oConn.Execute("SELECT @@identity", , adCmdText)
i am having trouble updating the database:
With rs
.AddNew ' create a new record
' add values to each field in the record
.Fields("datapath") = dpath
.Fields("analysistime") = atime
.Fields("reporttime") = rtime
.Fields("lastcalib") = lcalib
.Fields("analystname") = aname
.Fields("reportname") = rname
.Fields("batchstate") = "bstate"
.Fields("instrument") = "NA"
.Update ' stores the new record
End With
it is ONLY updating .Fields("instrument") = "NA", but for all other fields it is putting NULL values
I have a large number of rows that I would like to copy, but I need to change one field.
I can select the rows that I want to copy:
select * from Table where Event_ID = "120"
Now I want to copy all those rows and create new rows while setting the Event_ID to 155. How can I accomplish this?
I'm trying to write a store procedure that can take some input parameters (obviously), run multiple queries against those, taking the output from those and doing calculations, and from those calculations and the original queries, outputting a formatted text string like:
Number of Rows for max(Z) matching condition x and y of total rows matching x (x&y/x*100).
To explain the max(Z) bit, this will be the username field, it won't matter which actual entry is picked, because the where clause will filter the results by user id, is there a saner way to do this?
I'm developing a cms for a company that has multiple regional sites (us, uk, china, russia, etc..). Should I use a separate database for each of these sites or use a single database with a 'site' field in each table? My main concern is the table language encoding (ie, can storing strings in different langauges in the same table cause problems, such as sorting issues).
I'm trying to build a pager where it's just Next / Previous buttons that call a jquery function that post a JSON request. Inside the function, the current page "index" is retrieved from a hidden field and passed to the controller. Inside the controller, I reset the index if I'm on the last page of data. How would I pass the new index value back to the view? Or is there a better way to do what i'm trying to do?
Thanks
I know this title look familiar to some old questions, but i've looked at every single one of them, none of them solves.
And here is my codes:
class Island (object):E,W,R,P
def __init__(self, x, y):
self.init_animals(y)
def init_animals(y):
pass
isle = Island(x,y)
However, i got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in __init__
TypeError: init_animals() takes 1 positional arguments but 2 were given
Please tell me if i got any mistakes, im so confused by this.
Best regards
I have almost 200 listboxes. I'm changing their visibility according to my variables from database.
So I thought that, I prepared a arraylist. like this
ListBox[] lbs = this.Controls.OfType<ListBox>().ToArray();
And used like this.
for (int idx = 0; idx < Convert.ToInt32(ds.Tables[j].Rows[i][2])*12; idx++)
lbs[idx].Visible = true;
This codes are written to comboboxchange. Now everything is okay. But;
example;
first time I changed combobox
1-20 listboxes visible=true
I changed combobox again
not 1-20. 20,40 changing :S How can it be, can u tell me an alternative array list type, or another way?
I have a dictionary in C# like
Dictionary<Person, int>
and I want to sort that dictionary in place with respect to keys (a field in class Person). How can I do it? Every available help on the internet is that of lists with no particular example of in place sorting of Dictionary. Any help would be highly appreciated!
I am generating tables from classes in .NET and one problem is a class may have a field name key which is a reserved MySQL keyword. How do I escape it in a create table statement? (Note: The other problem below is text must be a fixed size to be indexed/unique)
create table if not exists misc_info (
id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
key TEXT UNIQUE NOT NULL,
value TEXT NOT NULL)ENGINE=INNODB;
I am trying to write a query to select all records from users table where User_DateCreated (datetime field) is = 3 months from today.
Any ideas? Thanks!
Hi guys,
I would like to know how have I do to add a field in the customer administration at system-configuration-Customer settings panel.
Have I create the system.xml file from the core and paste in the local folder with the same path?
and have I maintain all the content of the file or I can write only the portion interested?
thanks
i try to write any codes. For example i have 2 machine: A computer, B computer. My local machine A computer. i also have sql data base . with "select * from" i can learn PatientID. ForExample PatientID :123456. But this patient's pictures file in B Computer.Picture File Name is equal to PatientID. B Computer ports is open for me. I can listen B Computer's 51124 port. How can i get Files from B machine via Port(But this files includes pics ). But this is Windows App.
But i don't know files path. My program must find it automatically