logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 11-08-2014, 09:34 PM   #1
Rayzer
 
Join Date: Apr 2014
Posts: 5
Default change textfields readyonly

hi,

I have a form with several textfields.

I have questions

1) I have textfield A and textfield B which are questions about %, if the user enters 70 onto box A i need box B to auto fill 30?

2) If the user enters any value less the 100 into box A, I need boxes C,D,E to change from readyonly and Greyed out to active for the user to enter other details??

Dreamweaver cs6.
Rayzer is offline   Reply With Quote
Old 11-08-2014, 10:43 PM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,162
Default

Use JavaScript and write a function using a calculation and call it using onchange
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 11-09-2014, 09:22 PM   #3
Rayzer
 
Join Date: Apr 2014
Posts: 5
Default

Quote:
Originally Posted by edbr View Post
Use JavaScript and write a function using a calculation and call it using onchange
Thanks for the reply edbr, the problem is i am a complete noob!
Yes i can use Dreamweaver, but that's about it! What you say makes sense but i would not know where to start.

Any more help would be grateful
Rayzer is offline   Reply With Quote
Old 11-10-2014, 01:04 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,162
Default

you will have to look at javascript tutorials theres plenty around
below is a mash up to show haw values van be changed as a starter for you it uses onBlur so is fired as you leave the first field
Code:
<HTML>
<HEAD>
	<TITLE>Javascript Form Calculation</TITLE>

<SCRIPT language="JavaScript">

function Calculate()



{
   if (myform.Cost1.value < 100)


	myform.Cost1.value = 100- myform.Qty1.value;




	
	if (myform.Cost1.value > 1)

	myform.Cost2.value = myform.Cost1.value;   
	   
   myform.Subtotal.value = parseFloat(myform.Cost1.value)
	+ parseFloat(myform.Cost2.value);
}

</SCRIPT>
</HEAD>

<BODY>
<FORM NAME="myform"><P>

<TABLE BORDER="1" WIDTH="35%" >

	<TR>
		<TD width="53%">number</TD>
		<TD width="16%">

			<CENTER>
			<P><INPUT TYPE="TEXT" NAME="Qty1" SIZE="5"
				onBlur="Calculate();">
			</CENTER>

			
		</TD>
		<TD width="17%">
			<CENTER>
			</CENTER>
		</TD>

		<TD width="14%"><INPUT TYPE="TEXT" NAME="Cost1" SIZE="8"></TD>
	</TR>
	

	<TR>
		<TD>remainder</TD>
		<TD>
			<CENTER>
			  <P>
			    <input type="TEXT" name="Cost2" size="8">
          </CENTER>
		</TD>
		<TD>
			<CENTER>
			  <P>
	      </CENTER>
		</TD>
		<TD>&nbsp;</TD>
	</TR>
	

</TABLE>

</FORM>

</BODY>

</HTML>
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 11-10-2014, 11:21 AM   #5
Ricky55
Ricky55's Avatar
 
Join Date: Oct 2005
Location: West Yorkshire, UK
Posts: 1,855
Default

To grey out you use:-

<input type="text" disabled>
__________________
Qwerty Design

Check out my blog for web design insights.
http://www.qwerty-design.co.uk/
Follow me on Twitter: @QwertyDesignUK
Ricky55 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:06 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com