Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Form with onchange function

Guest
Oct 24, 2010 Oct 24, 2010

I want to give option like pay by credit card or check.

If one select credit card in select option it opens credit card related form inputs/Check than check related form inputs before submiting form.

I would start like

<cfform action"" method=""Post>

<cfselect name="paymenttype" query="test" display="paymenttype" value="paymenttype">

<option value ="other">Other</>

</select>

<cfif form.paymenttype = "Credit Card">

<cfinput type="Test" name="creditcomp">

<cfelseif form.paymenttype = "check">

<cfinput type="text" name="bankinfo">

</cfif>

<input type="submit" value="Submit"></cfform>

I belive I need to use Java script onChange event but I never did Java script before, can any one help me on it?

I have been using cfcase and submiting form at each and than made session variable to generate appropriate result but now I wanrt to do some change.

587
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 24, 2010 Oct 24, 2010
LATEST

For learning js, I recommend the book, Teach Yourself Javascript in 24 Hours.  It's how I learned.  There are also tutorials on webmonkey.

For what you are trying to do specifcally, I would put the credit card and bank stuff in separate divs and use js to show and hide them.  Google "javascript show hide"  to find code samples.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources