PDA

View Full Version : How to add hidden field to jump menu!!


tux
03-19-2007, 12:01 PM
Hi all,

I have a jump menu that sends an ID to the URL using this bit of Javascript.


<script language="javascript" type="text/javascript">

function submiter(){

id = document.getElementById('menu').value;

if(id != '0'){
document.location.href='gallery_detail.asp?photogr apherid='+id;
}

}
</script>


I need to send an extra ID so the script has been amended to this...


<script language="javascript" type="text/javascript">

function submiter(){


id = document.getElementById('menu').value;
phid = document.getElementById('photo').value;


if(id != '0'){
document.location.href='gallery_detail.asp?photogr apherid='+id+'&photo='+phid;
}

}
</script>

Here is the form....


<form id="form1" name="form1" method="post" action="">

<div align="right">
<select name="menu" class="photographerlist" onchange="submiter()">
<option value="">choose a photographer</option>
<%
While (NOT rs_photographerlist.EOF)
%>
<option value="<%=(rs_photographerlist.Fields.Item("photographerID").Value)%>"><%=(rs_photographerlist.Fields.Item("firstname").Value)%></option>
<%
rs_photographerlist.MoveNext()
Wend
If (rs_photographerlist.CursorType > 0) Then
rs_photographerlist.MoveFirst
Else
rs_photographerlist.Requery
End If
%>
</select>

</div>
</form>

How can I add the extra field 'photo' to the form.

Thanks all,

Paul

davidj
03-19-2007, 01:27 PM
your currently sending photographerid and this is working ok but you want to add an extra id .. phid

is phid related to photographerid through the recordset?

tux
03-19-2007, 01:44 PM
Hi David,

The other thread had been closed somehow???

No, the imageID (phid) is in a different RS.

In the Access DB the image table has a relationship with the photographer table via the photographerID if this helps.

With regards to my other post here...

http://www.dreamweaverclub.com/forum/showthread.php?t=25186

any ideas about my repeat region problem.

Thanks David, regards

Paul

davidj
03-19-2007, 02:06 PM
dont do ASP so i cant help with your repeat region

you need to join the tables in your SQL select so the result contains both tables. The you can access data from the one RS and then pass this into the querystring

tux
03-19-2007, 02:32 PM
Okay I'll try to suss that out this evening.

How would I add a new field to the jump menu form though. The script is going to be looking for a value from the 'photo' field in the form. If I could add the new field I could reference the value for imageID (phid) from the other recordset maybe.

I understand you dont do ASP. Cant wait to get this site done. I'm going PHP form now on.

Thanks as always David.

Paul

davidj
03-19-2007, 02:56 PM
How would I add a new field to the jump menu form though.


you dont need to add a field if you only have one RS with a join

What database are you using

tux
03-19-2007, 02:58 PM
Microsoft Access

davidj
03-19-2007, 04:12 PM
you need to create a join query table in access then use that in your Recordset Select

when you have this you then can access both id's from the one recordset

do you understand

(it would be allot easier in PHP)

tux
03-19-2007, 05:03 PM
I have a relationship between two tables in the DB.

The photographers table is related to the images table using the photographerID.

Is this what you mean or do you mean add an extra table. If so what fields would it require.

davidj
03-20-2007, 08:48 AM
you should be able to see a query in your database which contain fields from both tables. Its this you need to include in your Recordset

This is very hard to troubleshoot when interpreting 2 languages

tux
03-20-2007, 10:49 AM
Ok David,

I've sussed a different way to end up with the nearly the same result I was after, but it will do.

Dont know why I didnt see it before. I think I was making things too complicated for myself.

What I have done is used the photographerID in the URL which is in the images table as well and displayed the main image sorting it DESC the same as the thumbnails so that the main image is the same as the first thumbnail. Not what I was originally after but once a user clicks the next thumbnail it will no longer matter.

One prob sorted just the repeat region thing to sort, then I will need to build an application so the users can upload and maintain their own images. Do you know any good solutions for uploading images.

Thanks David, I've only been posting for a couple of weeks and your help has already become so valuable.

I'm sure I will be pestering you for more advice soon, especially when I start getting to grips with PHP.

Kind regards

Paul

davidj
03-20-2007, 11:10 AM
I'm sure I will be pestering you for more advice soon, especially when I start getting to grips with PHP.


pester as much as you like...

I will give 100% of my time to someone who invests the same amount of time in learning.