Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6954573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:37:24+00:00 2026-05-27T14:37:24+00:00

I’m trying to create a form when someone clicks an Edit button. I’m following

  • 0

I’m trying to create a form when someone clicks an “Edit” button. I’m following this example:
http://jqueryui.com/demos/dialog/modal-form.html

I have two problems:

  1. The button looks like a regular html button. When I click, it turns into the jquery button. Then I click again and the dialog opens up. Obviously I just want the jquery button that I click once to open the dialog.

  2. My form shows up on the main page AND when you click the edit button to open the dialog. It shouldn’t show up in the main page. It should only exist in the dialog. But from this tutorial (http://jqueryui.com/demos/dialog/modal-form.html) I fail to see them hiding the form, so I’m not sure how they do it.

My html form:

<div id="dialog-form" title="Change camera settings">
        <form>
        <fieldset>
            <label for="camera_name">Camera Name</label>
            <input type="text" size="16" maxlength="32" name="camera_name" id="camera_nameid" class="text ui-widget-content ui-corner-all" />
        </fieldset>
        </form>
</div>

My button (which is in another table showing all the cameras):

<button id="editbutton" onClick='edit(this, "<?php echo htmlentities($_SERVER['REQUEST_URI']); ?>", "<?php echo $result_cameras[$i]["camera_name"]; ?>", "<?php echo $camera_quality; ?>")'>Edit</button>

My jquery code. It still needs more work but just has one thing I’m processing which is camera_name:

function edit(t, to, cameraname, cameraquality,)
{
var js = jQuery.noConflict();
js(function() {
    var name = js( "#camera_name" );
    allFields = js( [] ).add( name );
    js("input:text").val(cameraname); //fill in the current data for cameraname

    js( "#dialog-form" ).dialog({
        autoOpen: false,
        height: 300,
        width: 350,
        modal: true,
        buttons: {
            "Edit camera settings": function() {
                allFields.removeClass( "ui-state-error" );

            },
            Cancel: function() {
                js( this ).dialog( "close" );
            }
        },
        close: function() {
            allFields.val( "" ).removeClass( "ui-state-error" );
        }
    });

    js( "#editbutton" )
        .button()
        .click(function() {
            js( "#dialog-form" ).dialog( "open" );
        });
});
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:37:25+00:00Added an answer on May 27, 2026 at 2:37 pm

    You should probably move the js that turns your editButton into an jQuery button outside of the edit method. You want to bind the click() function and declare it as a button BEFORE you go into your edit method.

    All this code only gets run after you click on the button the first time. That is why you are getting the strange functionality.

    Put this in your page outside of the edit function:

    $(function() {    
    
    $( "#dialog-form" ).dialog({
        autoOpen: false,
        height: 300,
        width: 350,
        modal: true,
        buttons: {
            "Edit camera settings": function() {
                allFields.removeClass( "ui-state-error" );
    
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        },
        close: function() {
            allFields.val( "" ).removeClass( "ui-state-error" );
        }
    });
    
    $( "#editbutton" )
        .button()
        .click(function() {
            $( "#dialog-form" ).dialog( "open" );
        });
    });
    

    You can probably keep the var js = jQuery.noConflict(); if you really need it. You may also want to move your edit onclick logic into the click method of editbutton but that depends on what you really want to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.