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 8054991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:16:10+00:00 2026-06-05T08:16:10+00:00

i have a model with all the fields about user info. and with crud

  • 0

i have a model with all the fields about user info. and with crud generator i created views and modified the view, form view, as below

Here i have hidden the editing profile part and when user clicks on edit it shows popup and editfields options. Now the problem is when i submit it submits whole form but i need to submit only the edited part and one more problem is that when i edit something and then cancel the form, it still keeps the value edited and saves then when i submit on any other portion of the form. Please suggest how can i achieve the partial submit of the form

<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'my-form',
'enableAjaxValidation'=>true,
'htmlOptions'=>array('enctype'=>'multipart/form-data'),
'action' => Yii::app()->createUrl('/userprofile/editprofile&id='.$model->id),
)); 
?>
<h4>Edit Profile Pic</h4>
<div>
<?php echo CHtml::fileField('profilePic'); ?>
<div id="editpic"></div>
<div class="btns" id="uploadbutton">            
<?php echo CHtml::ajaxSubmitButton('Update', $this->createUrl('/rageprofile/editprofile&id='.$model->id), array('update'=>'#targetdiv'));?>
</div>
</div>
<div class="editbutton">&#9998; Edit</div>
<div class="eitit edly einfo" style="z-index:9001;" >
<span class="close">&#10006;</span>
<h4>Basic Info</h4>
<?php echo $form->labelEx($model,'firstName'); ?>
<?php echo $form->textField($model,'firstName',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'firstName'); ?>
<?php echo $form->labelEx($model,'middleName'); ?>
<?php echo $form->textField($model,'middleName',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'middleName'); ?>
<?php echo $form->labelEx($model,'lastName'); ?>
<?php echo $form->textField($model,'lastName',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'lastName'); ?><br>
<?php echo $form->labelEx($model,'DOB'); ?>
<?php echo $form->textField($model,'d_o_b',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'d_o_b'); ?><br>
<?php echo $form->textField($model,'m_o_b',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'m_o_b'); ?><br>
<?php echo $form->textField($model,'y_o_b',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'y_o_b'); ?><br>
<?php echo $form->labelEx($model,'City'); ?>
<?php echo $form->textField($model,'city',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'city'); ?><br>
<?php echo $form->labelEx($model,'State'); ?>
<?php echo $form->textField($model,'state',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'state'); ?><br>
<?php echo $form->labelEx($model,'Country'); ?>
<?php echo $form->textField($model,'country',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'country'); ?><br>
<?php echo CHtml::ajaxSubmitButton('Update', $this->createUrl('/rageprofile/editprofile&id='.$model->id), array('update'=>'#targetdiv'));?>
</div>
</div>
</div>
<?php $this->endWidget(); ?>
  • 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-06-05T08:16:11+00:00Added an answer on June 5, 2026 at 8:16 am

    You’re trying to get two different things:

    1. Split a form
    2. Avoid sending empty inputs to server

    For the first thing you can try to one of the following two options:

    1. Create various forms, each of one will have its own ajaxSubmitButton to send data to server
    2. Leave your form intact, but instead of using an ajaxSubmitButon, use a various normal ‘CHtml::htmlButton’ and specify in his $htmlOptions array a custom js function to be called in the onclick event. These js functions (one for each button, for example) will collect data from some input, and not others, and will be responsible of sending data through ajax to the controller.

    For the second thing, you can use the js functions in the ‘onclick’ handlers, as I said before, or you cand modify just a little your code to do the following: Use the ‘beforeSend’ and ‘complete’ handlers of jQuery ajax call ($ajaxOptions in CHtml::ajaxSubmitButton) to create the attribute “disabled” in that fields that are empty before send, and delete them after complete. The ‘serialize’ jquery call that the ajax submit button uses, will not encode those attributes that are “disabled”.

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

Sidebar

Related Questions

I am trying to build a registration form. I have a model for all
I have the model Member that contains all informations about the registered member on
I have a form which permits updating of a user record. It contains fields
I'm doing this query: SomeObject.objects.annotate(something=Avg('something')).order_by(something).all() I normally have an aggregate field in my model
If I have Model.objects.all() I want to get only one object for any content_object=foo,
In our ColdFusion application we have stateless model objects. All the data I want
All, i have the following model defined, class header(models.Model): title = models.CharField(max_length = 255)
I have to delete all rows of a model with condition fkey_id = 1
Suppose I have class Foo(db.Model): bar = db.ReferenceProperty(Bar) foo = Foo.all().get() Is there a
I have made a data model, and now I've made a 2nd version. All

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.