473,597 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update form field by ID?

27 New Member
Ok my first post here so sorry if i mess something up.

I have to edit a page that uses some javascript and not sure really.

At the moment a user clicks on a button saying "black and white" and this shows an image on the page in black and white, it also update a hidden form field with the value "BW".

This works fine.

here is the code for that.


<!-- this shows the user the button to click -->

<div class="effect" onClick="enable Greyscale()">
<script language="javas cript">
greyscaleContro l('images/bandw.gif','ima ges/bandw.gif', true);
</script>
<span class="editboxa cttitle"><commo nweb:resource resid="EFFECTS_ BANDW"/></span>
</div>

<!-- end-->

<!-- the js funtion -->

function enableGreyscale ()
{
selectedproduct .att_effect = "BW";
selectedproduct .update();
draw();
}

<!-- end-->

So what i need to do now is give the users the functionality to choose a border colour.

This is not to redraw any image on the page, all that happens is a user clicks on a colour and i want it to update a hidden form field with the value of the colour.

This is what i tried with my limited knowledge.


<!-- this shows the user the button to click -->

<img src="images/canvas_colours/images/canvas_taupe_sm all.gif" style="cursor:p ointer" alt="Taupe" name="taupe_sma ll" id="taupe_small " onClick="enable Taupe();">

<!-- end -->

<!-- the js function -->

function enableTaupe()
{
selectedproduct .att_wrapcolour = "Taupe";
selectedproduct .update();
draw();
}

<!-- end -->



This doesn't work, the value in the form field just says value=""

Any help would be great!
May 31 '07 #1
17 4845
merseyside
48 New Member
Ok my first post here so sorry if i mess something up.

I have to edit a page that uses some javascript and not sure really.

At the moment a user clicks on a button saying "black and white" and this shows an image on the page in black and white, it also update a hidden form field with the value "BW".

This works fine.

here is the code for that.


<!-- this shows the user the button to click -->

<div class="effect" onClick="enable Greyscale()">
<script language="javas cript">
greyscaleContro l('images/bandw.gif','ima ges/bandw.gif', true);
</script>
<span class="editboxa cttitle"><commo nweb:resource resid="EFFECTS_ BANDW"/></span>
</div>

<!-- end-->

<!-- the js funtion -->

function enableGreyscale ()
{
selectedproduct .att_effect = "BW";
selectedproduct .update();
draw();
}

<!-- end-->

So what i need to do now is give the users the functionality to choose a border colour.

This is not to redraw any image on the page, all that happens is a user clicks on a colour and i want it to update a hidden form field with the value of the colour.

This is what i tried with my limited knowledge.


<!-- this shows the user the button to click -->

<img src="images/canvas_colours/images/canvas_taupe_sm all.gif" style="cursor:p ointer" alt="Taupe" name="taupe_sma ll" id="taupe_small " onClick="enable Taupe();">

<!-- end -->

<!-- the js function -->

function enableTaupe()
{
selectedproduct .att_wrapcolour = "Taupe";
selectedproduct .update();
draw();
}

<!-- end -->



This doesn't work, the value in the form field just says value=""

Any help would be great!
Is selectedproduct and object created in JavaScript? If so, does it have a property called att_wrapcolour?
May 31 '07 #2
cmcdermo
27 New Member
Yes it is, it usually has a order number at the end so it looks like

att_wrapcolour_ 657657657657
May 31 '07 #3
merseyside
48 New Member
Yes it is, it usually has a order number at the end so it looks like

att_wrapcolour_ 657657657657
Would att_effect also look like att_effect_6576 57657657? Where is the order number stored and is it available to the update() function?
May 31 '07 #4
cmcdermo
27 New Member
It is stored in the form (hidden).

Is it available to the update? what update?
Jun 1 '07 #5
merseyside
48 New Member
It is stored in the form (hidden).

Is it available to the update? what update?
The update method of selectedproduct

Expand|Select|Wrap|Line Numbers
  1. function enableGreyscale()
  2. {
  3.    selectedproduct.att_effect = "BW";
  4.    selectedproduct.update();
  5.    draw();
  6. }
  7.  
Looking at this function and taking the assumption that selectedproduct .att_effect would follow selectedproduct .att_effect_[order number] then the update() method must be doing something to selectedproduct .att_effect_[order number]? The draw() method refreshing the page somehow?
Jun 1 '07 #6
cmcdermo
27 New Member
ah this is what update does.

function update()
{
this.undoDisabl ed = false;
this.updateCrop ping();
this.updateZoom ();
}

I don't need it to do this, all i want is when the users clicks on enabletaupe that the hidden form field att_wrapcolor value gets updated.

Sorry i'm not very good at this!
Jun 1 '07 #7
merseyside
48 New Member
ah this is what update does.

function update()
{
this.undoDisabl ed = false;
this.updateCrop ping();
this.updateZoom ();
}

I don't need it to do this, all i want is when the users clicks on enabletaupe that the hidden form field att_wrapcolor value gets updated.

Sorry i'm not very good at this!
OK. Bearing in mind JavaScripts limitations with object-orientation. As I understand it, att_effect and att_wrapcolour should both be properties of the object selectedproduct, update(), updateCropping( ), updateZoom() are methods of the object selectedproduct. On clicking a link/button they should both be updated using the code as you've described in enableGreyscale () and enableTaupe().

You mention hidden fields on the form, what are their names? Is it

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="att_effect" value="" />
  2. or
  3. input type="hidden" name="att_effect_[ordernum]" value="" />
  4.  
Have you seen any code that looks anything (not exactly) like

Expand|Select|Wrap|Line Numbers
  1. document.formname.att_effect.value = ...
Jun 1 '07 #8
cmcdermo
27 New Member
So i'm thinking can i do something like. . . . .

function enableTaupe()
{
selectedproduct .att_Wrapcolour = "Taupe";
document.write. albumform.( 'att_wrapcolour _'+productcode )
selectedproduct .update();
draw();
}
Jun 1 '07 #9
cmcdermo
27 New Member
Hello,

I have a form field with an ID of WrapColour.

I am trying to do an "onclick" so when the user clicks it updates the value of the form field.

This is what I have tried

onclick="Javasc ript:document.w rite.albumform. WrapColour.valu e+"taupe";"

I get an error that "document.write .albumform.Wrap Colour is null or not an object".

The form field WrapColour has an ID and a value so I'm stuck.

Any help would be great.

Thanks.
Jun 4 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
12961
by: BlackFireNova | last post by:
This concerns an Access 2002 (XP) database. There are two fields, "Notes" (Memo Field) and "Notes Update" on a form (among others) which I am concerned with here. Problem: I need to be able to tell when people have added notes to a record. (this database contains 6000+ records) I want to set it up so that "Notes Update" is updated to the current date whenever someone actually enters data into, or modifies data in, the "Notes"...
4
26181
by: N. Graves | last post by:
Hello... thank you for your time. I have a form that has a List box of equipotent records and a sub form that will show the data of the equipment select from the list box. Is it possible to make a change in the name field in the details, then refresh the list box with new name? Please help and thanks!
3
3948
by: David | last post by:
Hi I use a calendar to update a field and the after update event no longer works, if i manually update it there is not a problem. How can I get this event to trigger Thanks in advance Dave
7
1813
by: gthompson | last post by:
Is this possible: Read fields(rows/columns) from one sql database table (TableA). Then edit/update the same 'field' in TableA; and in TableB edit/update a different field - all at the same time? This is the current situation in an Access Form using Sql for the backend. We would like to convert this Access Form to a Web Form using Visual Studio.net and VB.net. Please help. Thanks, gthompson
1
8494
by: Mark Reed | last post by:
Hi All, I'm having a problem with the following code. I've read quite a lot of old posts regarding the issue but none seem to affer a solution. The scenario is. I have a bound form which contains a couple of memo fields. I need to keep some sort of log as to when each update of the memo field occurs so I have locked bot the memo fields on the main form. To edit them, the user double clicks the ememo field which then opens an unbound...
5
2589
by: Stephen Plotnick | last post by:
I'm very new to VB.NET 2003 Here is what I have accomplished: MainSelectForm - Selects an item In a public class I pass a DataViewRow to ItemInformation1 Form ItemInformation2 Form
2
19585
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the field in table2. What I have is a form that is linked to Table2. If the users want to change a field in the main database (table1), they fill the change in to the form (which is linked to table2) If there is no change to the field, they simply...
16
3475
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record in a hidden field) I wish the user to be able to edit the data in the table, so I have extracted the records into hiddenfield, textareas, dropdown list and checkbox so that they can make changes. I named these elements as arrays and wish to run an...
14
3174
by: fjm1967 | last post by:
Hi all, I am nearing the end of programming my select forms and I will be soon need to create my insert and update forms. I have a question as to how this is best handled. I want to use one form to do the inserts and updates. Now, as far as the data in the database goes, if I have some data in a table already and only 1 field needs to be updated how does this work? Should I use an "if" conditional and isset on every field in the form or...
1
2104
by: sbecke01 | last post by:
Hello, I'm running into a problem where I have a form that people can fill out and submit. That works fine. It's submitting to an Access Db on the back end. It's a nomination form for an award so people are writing volumes at times. I've allowed the end user to submit their form but then come back and edit/update to continue and resubmit for as many times as needed. The issue is, that currently I have the update form hyperlinked to...
0
7965
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7885
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5426
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3881
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1231
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.