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

How to update and insert from same page using type="submit" or "button"

New Here ,
Apr 09, 2010 Apr 09, 2010

I am trying to remember where I saw the technique of adding a separate button to a coldfusion or flex page, other than the submit button, and calling a function to do something different like a query into database on insert page without inserting if onclick for update button is event.

803
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
Engaged ,
Apr 17, 2010 Apr 17, 2010

Hi Gregory,

If I understand what it is you are trying to accomplish, perhaps something

like this:

<cfinput type="button" name="update_record">

below would send you to designated page and pass the record_id var to

the page, along with any additional forms

onClick="this.form.action='http://path/to/cf_page.cfm?record_id=#URLEncodedFormat(record_id)#';this.form.submit()" onMouseOver="style.cursor='pointer'"

- or -

<cfinput type="submit" name="btn_insert" ..>

<cfinput type="submit" name="btn_update" ...>

then on same page try the following:

<cfisdefined('form.btn_insert')>

- - - do whatever it is you want done

<cfisdefined('form.btn_update')>

- - - do whatever it is you want done

Leonard B

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
New Here ,
Apr 20, 2010 Apr 20, 2010

When I get back to that page, your second example seems like it might work out. I might also try

using Phillip Churvis's advanced custom tag technique from Advanced Macromedia ColdFusion MX7 Application Development, in which one page adds, deletes, updates, and views records from a database.

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
New Here ,
Apr 20, 2010 Apr 20, 2010
LATEST

Hi Leonard,

When I get back to trying to get the form to work, it looks like your first example may also work if I check for cfif isdefined("url.recordid").

I probably could also use JavaScript and ColdFusion together through the use of some of Ben Forta's cascading selects type technique, as well.

Gregory

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