|
I know thats the way i should store the data in database but my problem is how will i know which dd was selected 1 so that i could store in column of first preference and so forth for 2nd pref and 3rd pref.
it looks like there will be lots of if and else block do you have any idea how can i strip out the correct dropdown with 1,2,3 ?
please help
|
|
|
|
|
Hm.
At first a question. Do you have think over my second solution (3 Columns for the 3 Prefs)? That solves really all problems and questions but it is a little redesign of code, struct and database.
Second: Normally you MUST HAVE 4 entries in the combobox (0,1,2,3) or ('','1','2','3'). Otherwise the user can not deselect a preference and the 0 ('') should be the default selection. Now you can get Combobox.SelectedIndex. This is direct the preference the user choice.
Additional Idea. Write a JavaScript for onChange in the combo (I think you should have this to validate, that user choice only 3 of the 6). In this JS-Func prepare the value of a hidden input element and store there the pref order of combo. Example: User select (6 combos): 0,0,2,1,0,3 -> value of hidden element should be: 4,3,6. Do you understand ?
Another additional idea. JS-Func for onChange in the combo but 3 hidden elements HD_pref1, HD_pref2 and HD_pref3.
function setPref2Hidden (obj, comboindex) {
var val = obj.value;
if (0 != val) {
document.getElementById ("HD_pref" + val).value = combo_index;
}
}
Use it as (Note: CP replace the onChange-keyword below throug "removed" :->:
<select id="DD_pref1" onChange="setPref2Hidden(this,1)" ...>
yselect id="DD_pref2" onChange="setPref2Hidden(this,2)" ...>
<select id="DD_pref3" onChange="setPref2Hidden(this,3)" ...>
...
In CodeBehind store the content of the 3 Hiddens in Database.
Greets
Stephan
\\\| \\ - -
( @ @ )
+---------------oOOo-(_)-oOOo-----------------+
| Stephan Pilz stephan.pilz@stephan-pilz.de |
| <a href=www.stephan-pilz.de>www.stephan-pilz.de</a> |
| ICQ#: 127823481 |
+-----------------------Oooo------------------+
oooO ( )
( ) ) /
\ ( (_/
\_)
|
|
|
|
|
Hey All,
I'm having a bit of a problem with loading some images using javascript. What I'm trying to do is parse out a query string value, and load an image using that value.
For instance, if someone went to:
http://www.mydomain.com?person=JohnDoe
It would parse out the name from the query string and load JohnDoe.gif into a image named portrait and write a cookie with that information; if there were no query string value, it would would load a default image. Now, this works in Firefox, but not IE; IE just results in that irritating little red "X" broken image box.
My Javascript:
========================
//get name from GET string
function GetName(CookieKey)
{
//try to read the key "name" value from cookie
var personalimg = readCookie('name')
if (personalimg) //if the cookie exists, load the image with the same name
{
//this appears to be the part that isn't working in IE only (firefox is fine)
//I have checked the image paths and the files do exist
document.contact.src="./images/people/" + personalimg + "Contact.gif";
}
else // if no cookie, check for name in query string or load default image
{
var query = window.location.search.substring(1);
var pair = query.split("=");
//if the cookie contains the key name, load it's value into the image
if (pair[0] == CookieKey)
{
document.contact.src="./images/people/" + pair[1] + "Contact.gif";
document.cookie = "name=" + pair[1] + ";"
}
else //load default image
{
document.contact.src = "./images/Contact.gif";
}
}
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
==================
My HTML:
==================
<img src="javascript:GetName('name')" name="contact" />
Note that I don't use Javascript too often so any suggestions on how to improve this would be much appreciated, as is any other help.
Thanks in advance!
-------------------
abort, retry, fail?
|
|
|
|
|
how to invisable a row or a cell in a table using java script according the change of radio button?
Jesuraj
|
|
|
|
|
You can hide a row through javascript like this:
document.getElementById('row0').style.dispay = 'none';
Best Regards,
Apurva Kaushal
|
|
|
|
|
You can hide a row the way that Apurva Kaushal suggested, but it's not advisable. Tables doesn't work very well with the display property. And hiding cells in a row can have quite unexpected results.
---
b { font-weight: normal; }
|
|
|
|
|
How to detect: is pop-up blocker on?
For example I want to open a new window, but if pop-up blocker has blocked it, then I want to open it in the same window, or say the user to turn off pop-up blocker? is it possible?
|
|
|
|
|
Hi!
It is very simple to detect popup blocer. Examine my code below please.
function detectPopupBlocker()
{
var myTest = window.open("about:blank","","directories=no,height=100,width=100,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no");
if (!myTest)
{
alert("Please allow pop ups for this web site!");
}
else
{
myTest.close();
return;
}
}
|
|
|
|
|
Thank you, really very simple...
|
|
|
|
|
|
PREMSONBABY wrote: can u please give me the javascript code for disabling the auto save option, in web browsers
No, I can't. There is no such code.
The auto save option is a function in the browser. It's up to the user to decide to use the function or not.
---
b { font-weight: normal; }
|
|
|
|
|
You don't have to remove stored data... you can try to change the name of fields in the form, or form name.
for example, create session and add first 3 characters from session id to the fields in form
session_id = afse422aa32321s // for example
<form name="formname_afs">
<input type="text" name="login_afs" />
... and so on
</form>
|
|
|
|
|
Suppose now I have a webpage with following content.
How are you?
Question about calling SAPI from javascript. I came across a difficult problem. Could anybody help me? Thanks!
How do you do?
And I use the following script to interact with the speech engine.
var VoiceObj = new ActiveXObject("Sapi.SpVoice");
VoiceObj.Speak(p2.innerText, SPF_ASYNC); //SPF_ASYNC == 2
What I want is to highlight the word which is currently being read by the speech engine. So it's a synchronization problem.
I think I have to handle the Word event of the SpVoice object. So I wrote the following signature. But what code shall I put in this function?
function VoiceObj::Word(Number, Position, CharacterPosition,Length)
{
}
Very thanks!
Jie
|
|
|
|
|
Hello pro's,
I need to insert a file name to the
|
|
|
|
|
An alternate question: How can I make a manual HTTP post of a form which contains file data? (for uploading) ActiveX can be used.....
|
|
|
|
|
i am having the client control in .aspx page.when the page post back,the values in the client control is clear.
how to maintain the view state in client control?
Jesuraj
|
|
|
|
|
You must save and load viewstate manually. Here comes an example of an HtmlSelect. Reason for the control was, if I have many, many values in control, the viewstate is bloat. Now I save only active value in viewstate and set set users choice during postback.
Imports System.ComponentModel
Imports System.Web.UI
Namespace MyOwnWebControls
<DefaultProperty("Text"), ToolboxData("<{0}:MyOwnHtmlSelect runat=server></{0}:MyOwnHtmlSelect>")> Public Class MyOwnHtmlSelect
Inherits System.Web.UI.HtmlControls.HtmlSelect
Dim m_text As String = ""
<Bindable(True), Category("Appearance"), Description("current content"), DefaultValue("")> Property Text() As String
Get
Return m_text
End Get
Set(ByVal Value As String)
m_text = Value
End Set
End Property
Protected Overrides Function SaveViewState() As Object
' make an array with dimension 2
Dim savedState(1) As Object
Try
' doesn't work
' savedState(0) = Me.Value
' savedState(1) = Me.Text
' this works - juhu
If Me.Items.Count > Me.SelectedIndex Then
savedState(0) = Me.Items(Me.SelectedIndex).Value
savedState(1) = Me.Items(Me.SelectedIndex).Text
Else
savedState(0) = ""
savedState(1) = ""
End If
Catch err As System.Exception
' Do some errormessage here
End Try
Return savedState
End Function
Protected Overrides Sub LoadViewState(ByVal savedState As Object)
Try
If Not savedState Is Nothing Then
' get the old values
Dim value As String = savedState(0)
Dim text As String = savedState(1)
' get value from the site
If Not Page.Request.Form(ID) Is Nothing Then
' set new value
value = Page.Request.Form(ID)
If value <> savedState(0) Then
' if the selection changed clear the text
text = ""
End If
Else
' can be nothing - for example the pt is disabled than it is not sent back to the server
' in this case we take the old value from VIEWSTATE because the user can't change the selected item
End If
' set the value of the poptext to the value of the selected item
Me.Value = value
' add one item with this value
Me.Items.Add(New System.Web.UI.WebControls.ListItem(text, value))
Me.SelectedIndex = 0
End If
Catch err As System.Exception
' Do some errormessages here
End Try
End Sub
End Class
End Namespace
Regards
Stephan
\\\| \\ - -
( @ @ )
+---------------oOOo-(_)-oOOo-----------------+
| Stephan Pilz stephan.pilz@stephan-pilz.de |
| <a href=www.stephan-pilz.de>www.stephan-pilz.de</a> |
| ICQ#: 127823481 |
+-----------------------Oooo------------------+
oooO ( )
( ) ) /
\ ( (_/
\_)
|
|
|
|
|
|
Hi, i'm using mail works pro to send out newsletters for my site. Because i'm using a free internet host it has smtp disabled and i can't use the mail() function.
Can someone tell me how i can change all the php code so it uses my smtp gmail host?
Please help..
|
|
|
|
|
So how many of you guys use google personalized home page
They have added tab feature recently which is quite cool,
I added some categories and it looks like this here[^]
Thoughts ?
-- moved at 22:37 Tuesday 19th September, 2006
|
|
|
|
|
|
you mean nobody uses/cares google personalized homepage ?
|
|
|
|
|
Most of the people I know don't care or use the Google personalized homepage or for that matter any of the 9 million personalized homepage websites out there.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan
|
|
|
|
|
Quartz... wrote: you mean nobody
only speaking (sleeping) for myself.
led mike
|
|
|
|
|
Why didn't you just post a link to the page itself?
Part of me thinks that you're hoping to drum up traffic for your new interview site by posting a link to an image hosted on the same server as said Web site and hoping that this ploy is enough to pique the interest of your viewers and maybe, just maybe, they'll erase the non-essential bits from the URL and see what interviewinfo.net is all about.
The rest of me doesn't undertand your fascination with Google Pages when you clearly have the programming[^] chops[^] to create cool stuff[^] on your own.
Quartz... wrote: Thoughts ?
Maybe I'm reading too much into it. Maybe that's because I am grumpy because I'm developing with VS2003 on a Win2k3 Std. box with SQL Server 2000... and only 512 MB of RAM. Maybe it's because my city's sanitation workers have been on strike for 2 weeks. Or maybe it's because today is Int'l Talk Like a Pirate Day and I just felt like being an AAARRRRse.
|
|
|
|
|